Merge pull request #4438 from qiuming-best/resource-filtering-test

Fix e2e test failures for the inappropriate optimaze of velero install
This commit is contained in:
Wenkai Yin(尹文开)
2021-12-10 14:00:38 +08:00
committed by GitHub
2 changed files with 10 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
Fix e2e test failures for the inappropriate optimaze of velero install
+9 -7
View File
@@ -68,30 +68,32 @@ type TestCase struct {
}
var TestClientInstance TestClient
var isVeleroInstalled bool = false
func TestFunc(test VeleroBackupRestoreTest) func() {
return func() {
var err error
TestClientInstance, err = NewTestClient()
Expect(err).To(Succeed(), "Failed to instantiate cluster client for backup tests")
test.Init()
Expect(test.Init()).To(Succeed(), "Failed to instantiate test cases")
BeforeEach(func() {
flag.Parse()
if VeleroCfg.InstallVelero && !isVeleroInstalled {
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
if VeleroCfg.InstallVelero {
Expect(VeleroInstall(context.Background(), &VeleroCfg, "", false)).To(Succeed())
isVeleroInstalled = true
}
})
AfterEach(func() {
if VeleroCfg.InstallVelero {
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
}
})
It(test.GetTestMsg().Text, func() {
Expect(RunTestCase(test)).To(Succeed(), test.GetTestMsg().FailedMSG)
})
}
}
func (t *TestCase) Init() {
func (t *TestCase) Init() error {
return nil
}
func (t *TestCase) CreateResources() error {