Skip to content

Run tests from always existing kubernetes directory that contains the tests, not the gce build k8s directory #351

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

Merged
merged 1 commit into from
Jul 19, 2019
Merged
Changes from all commits
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
16 changes: 8 additions & 8 deletions test/k8s-integration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ func handle() error {

// Run the tests using the testDir kubernetes
if len(*storageClassFile) != 0 {
err = runCSITests(pkgDir, k8sDir, *testFocus, *storageClassFile)
err = runCSITests(pkgDir, testDir, *testFocus, *storageClassFile)
} else if *migrationTest {
err = runMigrationTests(pkgDir, k8sDir, *testFocus)
err = runMigrationTests(pkgDir, testDir, *testFocus)
} else {
return fmt.Errorf("did not run either CSI or Migration test")
}
Expand All @@ -299,21 +299,21 @@ func setEnvProject(project string) error {
return nil
}

func runMigrationTests(pkgDir, k8sDir, testFocus string) error {
return runTestsWithConfig(k8sDir, testFocus, "--storage.migratedPlugins=kubernetes.io/gce-pd")
func runMigrationTests(pkgDir, testDir, testFocus string) error {
return runTestsWithConfig(testDir, testFocus, "--storage.migratedPlugins=kubernetes.io/gce-pd")
}

func runCSITests(pkgDir, k8sDir, testFocus, storageClassFile string) error {
func runCSITests(pkgDir, testDir, testFocus, storageClassFile string) error {
testDriverConfigFile, err := generateDriverConfigFile(pkgDir, storageClassFile)
if err != nil {
return err
}
testConfigArg := fmt.Sprintf("--storage.testdriver=%s", testDriverConfigFile)
return runTestsWithConfig(k8sDir, testFocus, testConfigArg)
return runTestsWithConfig(testDir, testFocus, testConfigArg)
}

func runTestsWithConfig(k8sDir, testFocus, testConfigArg string) error {
err := os.Chdir(k8sDir)
func runTestsWithConfig(testDir, testFocus, testConfigArg string) error {
err := os.Chdir(testDir)
if err != nil {
return err
}
Expand Down