@@ -99,15 +99,15 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
99
99
return nil
100
100
}
101
101
102
- // test setup containing multiple deployments
103
- func TestMultiDeployment1 (t * testing.T ) {
102
+ // test a setup containing multiple deployments
103
+ func TestMultiDeployment (t * testing.T ) {
104
104
longOrSkip (t )
105
105
106
106
k8sNameSpace := getNamespace (t )
107
107
k8sClient := mustNewKubeClient (t )
108
108
deploymentClient := kubeArangoClient .MustNewInCluster ()
109
109
110
- // Prepare deployment config
110
+ // Prepare deployment configurations
111
111
deploymentTemplate1 := newDeployment ("test-multidep1-1-" + uniuri .NewLen (4 ))
112
112
deploymentTemplate1 .Spec .Mode = api .NewMode (api .DeploymentModeCluster )
113
113
deploymentTemplate1 .Spec .StorageEngine = api .NewStorageEngine (api .StorageEngineRocksDB )
@@ -120,27 +120,28 @@ func TestMultiDeployment1(t *testing.T) {
120
120
deploymentTemplate2 .Spec .TLS = api.TLSSpec {} // should auto-generate cert
121
121
deploymentTemplate2 .Spec .SetDefaults (deploymentTemplate2 .GetName ()) // this must be last
122
122
123
- // Create deployment
123
+ // Create deployments
124
124
_ , err := deploymentClient .DatabaseV1alpha ().ArangoDeployments (k8sNameSpace ).Create (deploymentTemplate1 )
125
125
assert .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
126
126
127
127
_ , err = deploymentClient .DatabaseV1alpha ().ArangoDeployments (k8sNameSpace ).Create (deploymentTemplate2 )
128
128
assert .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
129
129
130
- // Wait for deployment to be ready
130
+ // Wait for deployments to be ready
131
131
deployment1 , err := waitUntilDeployment (deploymentClient , deploymentTemplate1 .GetName (), k8sNameSpace , deploymentIsReady ())
132
132
assert .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
133
133
134
134
deployment2 , err := waitUntilDeployment (deploymentClient , deploymentTemplate2 .GetName (), k8sNameSpace , deploymentIsReady ())
135
135
assert .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
136
136
137
- // Create a database client
137
+ // Create a database clients
138
138
ctx := context .Background ()
139
139
DBClient1 := mustNewArangodDatabaseClient (ctx , k8sClient , deployment1 , t )
140
140
assert .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
141
141
DBClient2 := mustNewArangodDatabaseClient (ctx , k8sClient , deployment2 , t )
142
142
assert .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
143
143
144
+ // Test if we are able to create a collections in both deployments.
144
145
db1 , err := DBClient1 .Database (ctx , "_system" )
145
146
assert .NoError (t , err , "failed to get database" )
146
147
_ , err = db1 .CreateCollection (ctx , "col1" , nil )
@@ -151,6 +152,8 @@ func TestMultiDeployment1(t *testing.T) {
151
152
_ , err = db2 .CreateCollection (ctx , "col2" , nil )
152
153
assert .NoError (t , err , "failed to create collection" )
153
154
155
+ // The newly created collections must be (only) visible in the deployment
156
+ // that it was created in. The following lines ensure this behavior.
154
157
collections1 , err := db1 .Collections (ctx )
155
158
assert .NoError (t , err , "failed to get collections" )
156
159
collections2 , err := db2 .Collections (ctx )
0 commit comments