Skip to content

Commit

Permalink
Move the kubernetes items to its own module, import that module only …
Browse files Browse the repository at this point in the history
…by metricbeat.
  • Loading branch information
blakerouse committed Apr 29, 2020
1 parent 431afe2 commit 2f42f18
Show file tree
Hide file tree
Showing 6 changed files with 637 additions and 21 deletions.
3 changes: 1 addition & 2 deletions dev-tools/mage/gotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ func GoTestIntegrationForModule(ctx context.Context) error {
foundModule = true

// Set MODULE because only want that modules tests to run inside the testing environment.
os.Setenv("MODULE", fi.Name())
runners, err := NewIntegrationRunners(path.Join("./module", fi.Name()))
runners, err := NewIntegrationRunners(path.Join("./module", fi.Name()), map[string]string{"MODULE": fi.Name()})
if err != nil {
return errors.Wrapf(err, "test setup failed for module %s", fi.Name())
}
Expand Down
9 changes: 5 additions & 4 deletions dev-tools/mage/integtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type IntegrationRunner struct {
type IntegrationRunners []*IntegrationRunner

// NewIntegrationRunners returns the integration test runners discovered from the provided path.
func NewIntegrationRunners(path string, passThroughEnvVars ...string) (IntegrationRunners, error) {
func NewIntegrationRunners(path string, passInEnv map[string]string) (IntegrationRunners, error) {
cwd, err := os.Getwd()
if err != nil {
return nil, err
Expand Down Expand Up @@ -195,11 +195,12 @@ func NewIntegrationRunners(path string, passThroughEnvVars ...string) (Integrati
runnerSteps = append(runnerSteps, steps...)

// Create the custom env for the runner.
env := map[string]string{
insideIntegrationTestEnvVar: "true",
env := map[string]string{}
for k, v := range passInEnv {
env[k] = v
}
env[insideIntegrationTestEnvVar] = "true"
passThroughEnvs(env, defaultPassthroughEnvVars...)
passThroughEnvs(env, passThroughEnvVars...)
if mg.Verbose() {
env["MAGEFILE_VERBOSE"] = "1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package mage
package kubernetes

import (
"fmt"
Expand Down
Loading

0 comments on commit 2f42f18

Please sign in to comment.