mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
Add rbac and annotation test cases
Signed-off-by: Ming <mqiu@vmware.com>
This commit is contained in:
@@ -92,6 +92,43 @@ func TestFunc(test VeleroBackupRestoreTest) func() {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFuncWithMultiIt(tests []VeleroBackupRestoreTest) func() {
|
||||
return func() {
|
||||
var err error
|
||||
var countIt int
|
||||
TestClientInstance, err = NewTestClient()
|
||||
Expect(err).To(Succeed(), "Failed to instantiate cluster client for backup tests")
|
||||
for k := range tests {
|
||||
Expect(tests[k].Init()).To(Succeed(), fmt.Sprintf("Failed to instantiate test %s case", tests[k].GetTestMsg().Desc))
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
flag.Parse()
|
||||
if VeleroCfg.InstallVelero {
|
||||
if countIt == 0 {
|
||||
Expect(VeleroInstall(context.Background(), &VeleroCfg, "", false)).To(Succeed())
|
||||
}
|
||||
countIt++
|
||||
}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
if VeleroCfg.InstallVelero {
|
||||
if countIt == len(tests) {
|
||||
Expect(VeleroUninstall(context.Background(), VeleroCfg.VeleroCLI, VeleroCfg.VeleroNamespace)).To((Succeed()))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
for k := range tests {
|
||||
curTest := tests[k]
|
||||
It(curTest.GetTestMsg().Text, func() {
|
||||
Expect(RunTestCase(curTest)).To(Succeed(), curTest.GetTestMsg().FailedMSG)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TestCase) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user