Fix e2e test failures for the inappropriate optimaze of velero install

Signed-off-by: ming qiu <mqiu@mqiu-a01.vmware.com>
This commit is contained in:
ming qiu
2021-12-09 23:12:59 +08:00
committed by Ming
parent c58fc1445e
commit d1e2c7b476
2 changed files with 10 additions and 7 deletions

View File

@@ -0,0 +1 @@
Fix e2e test failures for the inappropriate optimaze of velero install

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 {