Skip to content

Commit

Permalink
Run make update.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Apr 28, 2020
1 parent fbea221 commit 431afe2
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 36 deletions.
2 changes: 1 addition & 1 deletion dev-tools/mage/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (info *DockerInfo) IsBoot2Docker() bool {
// HaveDocker returns an error if docker is unavailable.
func HaveDocker() error {
if _, err := GetDockerInfo(); err != nil {
return fmt.Errorf("docker is not available")
return errors.Wrap(err, "docker is not available")
}
return nil
}
Expand Down
9 changes: 7 additions & 2 deletions dev-tools/mage/gotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func GoTestIntegrationForModule(ctx context.Context) error {
}

foundModule := false
failedModules := []string{}
for _, fi := range modulesFileInfo {
if !fi.IsDir() {
continue
Expand All @@ -163,17 +164,21 @@ func GoTestIntegrationForModule(ctx context.Context) error {
err = runners.Test("goIntegTest", func() error {
err := GoTest(ctx, GoTestIntegrationArgsForModule(fi.Name()))
if err != nil {
return errors.Wrapf(err, "integration tests failed for module %s", fi.Name())
return err
}
return nil
})
if err != nil {
return err
// err will already be report to stdout, collect failed module to report at end
failedModules = append(failedModules, fi.Name())
}
}
if module != "" && !foundModule {
return fmt.Errorf("no module %s", module)
}
if len(failedModules) > 0 {
return fmt.Errorf("failed modules: %s", strings.Join(failedModules, ", "))
}
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions dev-tools/mage/integtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
)

const (
// BEATS_DOCKER_INTEGRATION_TEST_ENV is used to indicate that we are inside
// BEATS_INSIDE_INTEGRATION_TEST_ENV is used to indicate that we are inside
// of the integration test environment.
insideIntegrationTestEnvVar = "BEATS_DOCKER_INTEGRATION_TEST_ENV"
insideIntegrationTestEnvVar = "BEATS_INSIDE_INTEGRATION_TEST_ENV"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ integration-tests-environment: prepare-tests build-image
-e RACE_DETECTOR=$(RACE_DETECTOR) \
-e DOCKER_COMPOSE_PROJECT_NAME=${DOCKER_COMPOSE_PROJECT_NAME} \
-e TEST_ENVIRONMENT=${TEST_ENVIRONMENT} \
-e BEATS_DOCKER_INTEGRATION_TEST_ENV=${BEATS_DOCKER_INTEGRATION_TEST_ENV} \
-e BEATS_INSIDE_INTEGRATION_TEST_ENV=${BEATS_INSIDE_INTEGRATION_TEST_ENV} \
-e GOFLAGS=${INSTALL_FLAG} \
beat make integration-tests

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22784,7 +22784,7 @@ type: long
--
*`kubernetes.apiserver.request.duration.bucket.us.*`*::
*`kubernetes.apiserver.request.duration.us.bucket.*`*::
+
--
Request duration, histogram buckets
Expand Down
23 changes: 23 additions & 0 deletions metricbeat/module/kubernetes/_meta/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Running integration tests.

Running the integration tests for the kubernetes module has the requirement of:

* docker
* kind
* kubectl

Once those tools are installed its as simple as:

```
MODULE="kubernetes" mage goIntegTest
```

The integration tester will use the default context from the kubectl configuration defined
in the `KUBECONFIG` environment variable. There is no requirement that the kubernetes even
be local to your development machine, it just needs to be accessible.

If no `KUBECONFIG` is set and `kind` is installed then the runner will use `kind` to create
a local cluster inside of your local docker to perform the intergation tests inside. The
`kind` cluster will be created and destroy before and after the test. If you would like to
keep the `kind` cluster running after the test has finished you can set `KIND_SKIP_DELETE=1`
inside of your environment.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetAPIServerConfig(t, "apiserver")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetAPIServerConfig(t, "controllermanager")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_container")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_cronjob")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_deployment")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_node")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_persistentvolume")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_persistentvolumeclaim")
metricSet := mbtest.NewReportingMetricSetV2Error(t, config)
events, errs := mbtest.ReportingFetchV2Error(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_pod")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_replicaset")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_resourcequota")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_service")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_statefulset")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

func TestFetchMetricset(t *testing.T) {
config := test.GetKubeStateMetricsConfig(t, "state_storageclass")
metricSet := mbtest.NewReportingMetricSetV2(t, config)
events, errs := mbtest.ReportingFetchV2(metricSet)
metricSet := mbtest.NewFetcher(t, config)
events, errs := metricSet.FetchEvents()
if len(errs) > 0 {
t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs)
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/googlepubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func defaultTestConfig() *common.Config {
}

func isInDockerIntegTestEnv() bool {
return os.Getenv("BEATS_DOCKER_INTEGRATION_TEST_ENV") != ""
return os.Getenv("BEATS_INSIDE_INTEGRATION_TEST_ENV") != ""
}

func runTest(t *testing.T, cfg *common.Config, run func(client *pubsub.Client, input *pubsubInput, out *stubOutleter, t *testing.T)) {
Expand Down

0 comments on commit 431afe2

Please sign in to comment.