Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MODULE in mage goIntegTest for metricbeat #17147

Merged
merged 4 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- `supported-versions.yml` can be used in metricbeat python system tests to obtain the build args for docker compose builds. {pull}14520[14520]
- Fix dropped errors in the tests for the metricbeat Azure module. {pull}13773[13773]
- New mage target for Functionbeat: generate pkg folder to make manager easier. {pull}15580[15880]
- Add support for MODULE environment variable in `mage goIntegTest` in metricbeat to run integration tests for a single module. {pull}[]
7 changes: 7 additions & 0 deletions dev-tools/mage/gotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ func DefaultTestBinaryArgs() TestBinaryArgs {
// This method executes integration tests for a single module at a time.
// Use TEST_COVERAGE=true to enable code coverage profiling.
// Use RACE_DETECTOR=true to enable the race detector.
// Use MODULE=module to run only tests for `module`.
func GoTestIntegrationForModule(ctx context.Context) error {
return RunIntegTest("goIntegTest", func() error {
module := EnvOr("MODULE", "")
if module != "" {
err := GoTest(ctx, GoTestIntegrationArgsForModule(module))
return errors.Wrapf(err, "integration tests failed for module %s", module)
}

modulesFileInfo, err := ioutil.ReadDir("./module")
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions dev-tools/mage/integtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func RunIntegTest(mageTarget string, test func() error, passThroughEnvVars ...st
"RACE_DETECTOR",
"TEST_TAGS",
"PYTHON_EXE",
"MODULE",
}
env = append(env, passThroughEnvVars...)
return runInIntegTestEnv(mageTarget, test, env...)
Expand Down
1 change: 1 addition & 0 deletions metricbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func CollectDocs() error {
// Use TEST_COVERAGE=true to enable code coverage profiling.
// Use RACE_DETECTOR=true to enable the race detector.
// Use TEST_TAGS=tag1,tag2 to add additional build tags.
// Use MODULE=module to run only tests for `module`.
func GoIntegTest(ctx context.Context) error {
return devtools.GoTestIntegrationForModule(ctx)
}
1 change: 1 addition & 0 deletions x-pack/metricbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func IntegTest() {
// Use TEST_COVERAGE=true to enable code coverage profiling.
// Use RACE_DETECTOR=true to enable the race detector.
// Use TEST_TAGS=tag1,tag2 to add additional build tags.
// Use MODULE=module to run only tests for `module`.
func GoIntegTest(ctx context.Context) error {
return devtools.GoTestIntegrationForModule(ctx)
}
Expand Down