@@ -29,56 +29,82 @@ import (
29
29
30
30
// Test case for validating volume snapshots
31
31
// with different storage providers in different k8s environments
32
- var _ = Describe ("Verify volume snapshot" , Label (tests .LabelBackupRestore , tests .LabelStorage ), func () {
33
- const (
34
- sampleFile = fixturesDir + "/volume_snapshot/cluster_volume_snapshot.yaml.template"
35
- clusterName = "volume-snapshot"
36
- level = tests .Medium
37
- )
38
- BeforeEach (func () {
39
- if testLevelEnv .Depth < int (level ) {
40
- Skip ("Test depth is lower than the amount requested for this test" )
41
- }
42
- // This need to be removed later
43
- if IsLocal () {
44
- Skip ("This test is only run on AKS, EKS and GKE clusters for now" )
45
- }
46
- })
47
- // Initializing a global namespace variable to be used in each test case
48
- var namespace , namespacePrefix string
49
- // Gathering the default volumeSnapshot class for the current environment
50
- volumeSnapshotClassName := os .Getenv ("E2E_DEFAULT_VOLUMESNAPSHOT_CLASS" )
32
+ var _ = Describe ("Verify Volume Snapshot" ,
33
+ Label (tests .LabelBackupRestore , tests .LabelStorage , tests .LabelSnapshot ), func () {
34
+ const (
35
+ sampleFile = fixturesDir + "/volume_snapshot/cluster_volume_snapshot.yaml.template"
36
+ clusterName = "volume-snapshot"
37
+ level = tests .Medium
38
+ )
39
+ BeforeEach (func () {
40
+ if testLevelEnv .Depth < int (level ) {
41
+ Skip ("Test depth is lower than the amount requested for this test" )
42
+ }
43
+ // This need to be removed later
44
+ if IsLocal () {
45
+ Skip ("This test is only run on AKS, EKS and GKE clusters for now" )
46
+ }
47
+ })
48
+ // Initializing a global namespace variable to be used in each test case
49
+ var namespace , namespacePrefix string
50
+ // Gathering the default volumeSnapshot class for the current environment
51
+ volumeSnapshotClassName := os .Getenv ("E2E_DEFAULT_VOLUMESNAPSHOT_CLASS" )
51
52
52
- Context ("Can create a Volume Snapshot" , Ordered , func () {
53
- BeforeAll (func () {
54
- var err error
55
- // Initializing namespace variable to be used in test case
56
- namespacePrefix = "volume-snapshot"
57
- namespace , err = env .CreateUniqueNamespace (namespacePrefix )
58
- Expect (err ).ToNot (HaveOccurred ())
59
- DeferCleanup (func () error {
60
- if CurrentSpecReport ().Failed () {
61
- env .DumpNamespaceObjects (namespace , "out/" + CurrentSpecReport ().LeafNodeText + ".log" )
62
- }
63
- return env .DeleteNamespace (namespace )
53
+ Context ("Can create a Volume Snapshot" , Ordered , func () {
54
+ BeforeAll (func () {
55
+ var err error
56
+ // Initializing namespace variable to be used in test case
57
+ namespacePrefix = "volume-snapshot"
58
+ namespace , err = env .CreateUniqueNamespace (namespacePrefix )
59
+ Expect (err ).ToNot (HaveOccurred ())
60
+ DeferCleanup (func () error {
61
+ if CurrentSpecReport ().Failed () {
62
+ env .DumpNamespaceObjects (namespace , "out/" + CurrentSpecReport ().LeafNodeText + ".log" )
63
+ }
64
+ return env .DeleteNamespace (namespace )
65
+ })
66
+ // Creating a cluster with three nodes
67
+ AssertCreateCluster (namespace , clusterName , sampleFile , env )
64
68
})
65
- // Creating a cluster with three nodes
66
- AssertCreateCluster (namespace , clusterName , sampleFile , env )
67
- })
68
69
69
- It ("Using the kubectl cnpg plugin" , func () {
70
- err := utils .CreateVolumeSnapshotBackup (volumeSnapshotClassName , namespace , clusterName )
71
- Expect (err ).ToNot (HaveOccurred ())
70
+ It ("using the kubectl cnpg plugin" , func () {
71
+ err := utils .CreateVolumeSnapshotBackup (
72
+ volumeSnapshotClassName ,
73
+ namespace ,
74
+ clusterName ,
75
+ "" ,
76
+ )
77
+ Expect (err ).ToNot (HaveOccurred ())
78
+
79
+ out , _ , err := utils .Run (fmt .Sprintf ("kubectl get volumesnapshot -n %v" , namespace ))
80
+ Expect (err ).ToNot (HaveOccurred ())
81
+ GinkgoWriter .Println ("output of current volumesnapshot \n " )
82
+ GinkgoWriter .Println (out )
72
83
73
- out , _ , err := utils .Run (fmt .Sprintf ("kubectl get volumesnapshot -n %v" , namespace ))
74
- Expect (err ).ToNot (HaveOccurred ())
75
- GinkgoWriter .Print ("output of current volumesnapshot" )
76
- GinkgoWriter .Print (out )
84
+ out , _ , err = utils .Run (fmt .Sprintf ("kubectl get volumesnapshotcontent -n %v" , namespace ))
85
+ Expect (err ).ToNot (HaveOccurred ())
86
+ GinkgoWriter .Println ("output of current volumesnapshotcontent \n " )
87
+ GinkgoWriter .Println (out )
88
+ })
89
+
90
+ It ("using the kubectl cnpg plugin with a custom suffix" , func () {
91
+ err := utils .CreateVolumeSnapshotBackup (
92
+ volumeSnapshotClassName ,
93
+ namespace ,
94
+ clusterName ,
95
+ "test" ,
96
+ )
97
+ Expect (err ).ToNot (HaveOccurred ())
77
98
78
- out , _ , err = utils .Run (fmt .Sprintf ("kubectl get volumesnapshotcontent -n %v" , namespace ))
79
- Expect (err ).ToNot (HaveOccurred ())
80
- GinkgoWriter .Print ("output of current volumesnapshotcontent" )
81
- GinkgoWriter .Print (out )
99
+ out , _ , err := utils .Run (fmt .Sprintf ("kubectl get volumesnapshot -n %v" , namespace ))
100
+ Expect (err ).ToNot (HaveOccurred ())
101
+ GinkgoWriter .Println ("output of current volumesnapshot \n " )
102
+ GinkgoWriter .Println (out )
103
+
104
+ out , _ , err = utils .Run (fmt .Sprintf ("kubectl get volumesnapshotcontent -n %v" , namespace ))
105
+ Expect (err ).ToNot (HaveOccurred ())
106
+ GinkgoWriter .Println ("output of current volumesnapshotcontent \n " )
107
+ GinkgoWriter .Println (out )
108
+ })
82
109
})
83
110
})
84
- })
0 commit comments