Skip to content

Commit

Permalink
fix integration test
Browse files Browse the repository at this point in the history
Signed-off-by: chrismark <chrismarkou92@gmail.com>
  • Loading branch information
ChrsMark committed Nov 22, 2019
1 parent 46442e0 commit f0d9a37
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 26 deletions.
10 changes: 1 addition & 9 deletions metricbeat/module/kafka/broker/broker_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,19 @@

// +build integration

package partition
package broker

import (
"os"
"testing"
"time"

"github.com/elastic/beats/libbeat/tests/compose"
"github.com/elastic/beats/metricbeat/mb"
mbtest "github.com/elastic/beats/metricbeat/mb/testing"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}

func TestData(t *testing.T) {
service := compose.EnsureUp(t, "kafka",
compose.UpWithTimeout(600*time.Second),
Expand Down
33 changes: 33 additions & 0 deletions metricbeat/module/kafka/broker/broker_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package broker

import (
"os"

"github.com/elastic/beats/metricbeat/mb"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}
10 changes: 1 addition & 9 deletions metricbeat/module/kafka/consumer/consumer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,19 @@

// +build integration

package partition
package consumer

import (
"os"
"testing"
"time"

"github.com/elastic/beats/libbeat/tests/compose"
"github.com/elastic/beats/metricbeat/mb"
mbtest "github.com/elastic/beats/metricbeat/mb/testing"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}

func TestData(t *testing.T) {
service := compose.EnsureUp(t, "kafka",
compose.UpWithTimeout(600*time.Second),
Expand Down
33 changes: 33 additions & 0 deletions metricbeat/module/kafka/consumer/consumer_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package consumer

import (
"os"

"github.com/elastic/beats/metricbeat/mb"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}
8 changes: 0 additions & 8 deletions metricbeat/module/kafka/producer/producer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,16 @@
package partition

import (
"os"
"testing"
"time"

"github.com/elastic/beats/libbeat/tests/compose"
"github.com/elastic/beats/metricbeat/mb"
mbtest "github.com/elastic/beats/metricbeat/mb/testing"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}

func TestData(t *testing.T) {
service := compose.EnsureUp(t, "kafka",
compose.UpWithTimeout(600*time.Second),
Expand Down
33 changes: 33 additions & 0 deletions metricbeat/module/kafka/producer/producer_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package producer

import (
"os"

"github.com/elastic/beats/metricbeat/mb"
// Register input module and metricset
_ "github.com/elastic/beats/metricbeat/module/jolokia"
_ "github.com/elastic/beats/metricbeat/module/jolokia/jmx"
)

func init() {
// To be moved to some kind of helper
os.Setenv("BEAT_STRICT_PERMS", "false")
mb.Registry.SetSecondarySource(mb.NewLightModulesSource("../../../module"))
}

0 comments on commit f0d9a37

Please sign in to comment.