func FindTestConfigs()

in infra/blueprint-test/pkg/discovery/discover.go [55:95]


func FindTestConfigs(t testing.TB, intTestDir string) map[string]string {
	testBase := intTestDir
	examplesBase := path.Join(testBase, "../../", ExamplesDir)
	fixturesBase := path.Join(testBase, "../", FixtureDir)
	explicitTests, err := findDirs(testBase)
	if err != nil {
		t.Logf("Skipping explicit tests discovery: %v", err)
	}
	fixtures, err := findDirs(fixturesBase)
	if err != nil {
		t.Logf("Skipping fixtures discovery: %v", err)
	}
	examples, err := findDirs(examplesBase)
	if err != nil {
		t.Logf("Skipping examples discovery: %v", err)
	}
	testCases := make(map[string]string)

	// if a fixture exists but no explicit test defined
	for n := range fixtures {
		_, ok := explicitTests[n]
		if !ok {
			testDir := path.Join(fixturesBase, n)
			testName := fmt.Sprintf("%s/%s", path.Base(path.Dir(testDir)), path.Base(testDir))
			testCases[testName] = testDir
		}
	}
	// if an example exists that does not have a fixture nor explicit test defined
	for n := range examples {
		_, okTest := explicitTests[n]
		_, okFixture := fixtures[n]
		if !okTest && !okFixture {
			testDir := path.Join(examplesBase, n)
			testName := fmt.Sprintf("%s/%s", path.Base(path.Dir(testDir)), path.Base(testDir))
			testCases[testName] = testDir
		}
	}
	// explicit tests in integration/test_name are not gathered since they are invoked directly
	return testCases

}