forked from red-hat-storage/odf-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_teardown.go
51 lines (36 loc) · 1.12 KB
/
setup_teardown.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package e2e
import (
"fmt"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
// Setup is the function called to initialize the test environment
func Setup() {
debug("Setup: started\n")
SuiteFailed = true
if OdfOperatorInstall {
debug("Setup: deploying ODF Operator\n")
err := DeployManager.DeployODFWithOLM(OdfCatalogSourceImage, OdfSubscriptionChannel)
gomega.Expect(err).To(gomega.BeNil())
debug("Setup: Checking if all the CSVs have succeeded\n")
err = DeployManager.CheckAllCsvs(CsvNames)
gomega.Expect(err).To(gomega.BeNil())
}
SuiteFailed = false
debug("Setup: completed\n")
}
// TearDown is the function called to tear down the test environment
func TearDown() {
debug("TearDown: started\n")
SuiteFailed = true
if OdfClusterUninstall {
debug("TearDown: uninstalling ODF Operator\n")
err := DeployManager.UndeployODFWithOLM(OdfCatalogSourceImage, OdfSubscriptionChannel)
gomega.Expect(err).To(gomega.BeNil())
}
SuiteFailed = false
debug("TearDown: completed\n")
}
func debug(msg string, args ...interface{}) {
ginkgo.GinkgoWriter.Write([]byte(fmt.Sprintf(msg, args...))) //nolint:errcheck
}