@@ -22,18 +22,18 @@ import (
22
22
"github.com/clastix/kamaji/internal/utilities"
23
23
)
24
24
25
- var _ = Describe ( "When migrating a Tenant Control Plane to another datastore" , func ( ) {
25
+ func featureTestMigration ( driver string ) {
26
26
var tcp * kamajiv1alpha1.TenantControlPlane
27
27
// Create a TenantControlPlane resource into the cluster
28
28
JustBeforeEach (func () {
29
29
// Fill TenantControlPlane object
30
30
tcp = & kamajiv1alpha1.TenantControlPlane {
31
31
ObjectMeta : metav1.ObjectMeta {
32
- Name : fmt .Sprintf ("migrating-%s-etcd " , rand .String (5 )),
32
+ Name : fmt .Sprintf ("migrating-%s-%s " , rand .String (5 ), driver ),
33
33
Namespace : "default" ,
34
34
},
35
35
Spec : kamajiv1alpha1.TenantControlPlaneSpec {
36
- DataStore : "etcd -bronze" ,
36
+ DataStore : fmt . Sprintf ( "%s -bronze", driver ) ,
37
37
ControlPlane : kamajiv1alpha1.ControlPlane {
38
38
Deployment : kamajiv1alpha1.DeploymentSpec {
39
39
Replicas : pointer .To (int32 (1 )),
@@ -91,7 +91,7 @@ var _ = Describe("When migrating a Tenant Control Plane to another datastore", f
91
91
return err
92
92
}
93
93
94
- tcp .Spec .DataStore = "etcd -silver"
94
+ tcp .Spec .DataStore = fmt . Sprintf ( "%s -silver", driver )
95
95
96
96
return k8sClient .Update (context .Background (), tcp )
97
97
}, time .Minute , time .Second ).ShouldNot (HaveOccurred ())
@@ -114,11 +114,19 @@ var _ = Describe("When migrating a Tenant Control Plane to another datastore", f
114
114
}
115
115
116
116
return tcp .Status .Storage .DataStoreName
117
- }, time .Minute , time .Second ).Should (BeEquivalentTo ("etcd -silver" ))
117
+ }, time .Minute , time .Second ).Should (BeEquivalentTo (fmt . Sprintf ( "%s -silver", driver ) ))
118
118
119
119
By ("checking the presence of the previous Namespace" )
120
120
Eventually (func () error {
121
121
return tcpClient .Get (context .Background (), types.NamespacedName {Name : ns .GetName ()}, & corev1.Namespace {})
122
122
}).ShouldNot (HaveOccurred ())
123
123
})
124
+ }
125
+
126
+ var _ = Describe ("When migrating a Tenant Control Plane to another datastore (etcd)" , func () {
127
+ featureTestMigration ("etcd" )
128
+ })
129
+
130
+ var _ = Describe ("When migrating a Tenant Control Plane to another datastore (postgresql)" , func () {
131
+ featureTestMigration ("postgresql" )
124
132
})
0 commit comments