func ConfigureIntegrationTest(t *testing.T, testSettings *evergreen.Settings,
	testName string) {
	if !(*runIntegration) {
		t.Skip(fmt.Sprintf("Skipping integration test %v...", testName))
	}

	// make sure an override file is provided
	if (*settingsOverride) == "" {
		panic("Integration tests need a settings override file to be" +
			" provided")
	}

	// grab the file with the integration test settings
	integrationSettings, err := evergreen.NewSettings(*settingsOverride)
	if err != nil {
		panic(fmt.Sprintf("Error opening settings override file %v: %v",
			*settingsOverride, err))
	}

	// override the appropriate params
	t.Logf("Loading cloud provider settings from %v", *settingsOverride)

	testSettings.Providers = integrationSettings.Providers
	testSettings.Credentials = integrationSettings.Credentials
	testSettings.AuthConfig = integrationSettings.AuthConfig
	testSettings.Plugins = integrationSettings.Plugins
	testSettings.Jira = integrationSettings.Jira
}
Example #2
0
func ConfigureIntegrationTest(t *testing.T, testSettings *evergreen.Settings,
	testName string) {

	SkipTestUnlessAll(t, testName)

	// make sure an override file is provided
	if (*settingsOverride) == "" {
		msg := "Integration tests need a settings override file to be provided"
		keyName := "evergreen.settingsOverride"
		if !strings.Contains(os.Getenv("TEST_ARGS"), keyName) {
			panic(msg)
		}
		for _, k := range os.Environ() {
			if strings.HasPrefix(k, keyName) {
				parts := strings.Split(k, "=")
				if len(parts) < 2 {
					panic(msg)
				}
				*settingsOverride = parts[1]
			}
		}
	}

	// grab the file with the integration test settings
	integrationSettings, err := evergreen.NewSettings(*settingsOverride)
	if err != nil {
		panic(fmt.Sprintf("Error opening settings override file %v: %v",
			*settingsOverride, err))
	}

	// override the appropriate params
	t.Logf("Loading cloud provider settings from %v", *settingsOverride)

	testSettings.Providers = integrationSettings.Providers
	testSettings.Credentials = integrationSettings.Credentials
	testSettings.AuthConfig = integrationSettings.AuthConfig
	testSettings.Plugins = integrationSettings.Plugins
	testSettings.Jira = integrationSettings.Jira
}