Skip to content
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

Fix the context choosing error after migration case. #8293

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GINKGO_LABELS ?=
# When --fail-fast is set, the entire suite will stop when the first failure occurs.
# Enable --fail-fast by default.
# https://onsi.github.io/ginkgo/#mental-model-how-ginkgo-handles-failure
FAIL_FAST ?= true
FAIL_FAST ?= false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the impact for this change? will it take more time for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FAIL_FAST flag determines how to handle errors met during the test suite running.
If FAIL_FAST is set to true, the test suite stops running immediately.
If FAIL_FAST is set to false, the test suite continues running on meeting test error.

The FAIL_FAST flag is introduced to help debug the test error, so set the default value to false, and let the Jenkins pipeline can pass the value to determine whether the flag should be turned on.

VELERO_CLI ?=$$(pwd)/../_output/bin/$(GOOS)/$(GOARCH)/velero
VELERO_IMAGE ?= velero/velero:main
PLUGINS ?=
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ var _ = Describe("Velero test on parallel files upload",
var _ = Describe("Velero test on parallel files download",
Label("UploaderConfig", "ParallelFilesDownload"), ParallelFilesDownloadTest)

func GetKubeconfigContext() error {
func GetKubeConfigContext() error {
var err error
var tcDefault, tcStandby TestClient
tcDefault, err = NewTestClient(VeleroCfg.DefaultClusterContext)
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestE2e(t *testing.T) {
}

var err error
if err = GetKubeconfigContext(); err != nil {
if err = GetKubeConfigContext(); err != nil {
fmt.Println(err)
t.FailNow()
}
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version)
}
})
AfterEach(func() {
By(fmt.Sprintf("Switch to default kubeconfig context %s", veleroCfg.DefaultClusterContext), func() {
Expect(KubectlConfigUseContext(context.Background(), veleroCfg.DefaultClusterContext)).To(Succeed())
veleroCfg.ClientToInstallVelero = veleroCfg.DefaultClient
veleroCfg.ClusterToInstallVelero = veleroCfg.DefaultClusterName
})

if CurrentSpecReport().Failed() && veleroCfg.FailFast {
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
} else {
Expand All @@ -113,6 +107,12 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version)
DeleteNamespace(context.Background(), *veleroCfg.StandbyClient, migrationNamespace, true)
})
}

By(fmt.Sprintf("Switch to default kubeconfig context %s", veleroCfg.DefaultClusterContext), func() {
Expect(KubectlConfigUseContext(context.Background(), veleroCfg.DefaultClusterContext)).To(Succeed())
veleroCfg.ClientToInstallVelero = veleroCfg.DefaultClient
veleroCfg.ClusterToInstallVelero = veleroCfg.DefaultClusterName
})
}
})
When("kibishii is the sample workload", func() {
Expand Down
Loading