func()

in cmd/e2e-test/rune2e/command.go [225:258]


func (c *command) loadTestConfig(testResources cluster.TestResources, logger logr.Logger) (e2e.TestConfig, error) {
	testConfig := e2e.TestConfig{
		ClusterName:   testResources.ClusterName,
		ClusterRegion: testResources.ClusterRegion,
		Endpoint:      testResources.EKS.Endpoint,
		NodeadmUrlAMD: c.nodeadmAMDURL,
		NodeadmUrlARM: c.nodeadmARMURL,
		LogsBucket:    c.logsBucket,
	}

	if c.testConfigFile != "" {
		// Validate that individual test config flags are not also set
		if c.nodeadmAMDURL != defaultNodeadmAMDURL ||
			c.nodeadmARMURL != defaultNodeadmARMURL ||
			c.logsBucket != "" ||
			c.artifactsDir != "" {
			return testConfig, fmt.Errorf("cannot specify both test-config file and individual test config flags (nodeadm-amd-url, nodeadm-arm-url, logs-bucket, artifacts-dir)")
		}

		// Load test config from file
		testConfigData, err := os.ReadFile(c.testConfigFile)
		if err != nil {
			return testConfig, fmt.Errorf("reading test config file: %w", err)
		}

		if err := yaml.Unmarshal(testConfigData, &testConfig); err != nil {
			return testConfig, fmt.Errorf("unmarshaling test config: %w", err)
		}

		logger.Info("Loaded test configuration from file", "path", c.testConfigFile)
	}

	return testConfig, nil
}