@@ -27,7 +27,7 @@ import (
27
27
"testing"
28
28
29
29
"github.com/dchest/uniuri"
30
- "github.com/stretchr/testify/assert "
30
+ "github.com/stretchr/testify/require "
31
31
32
32
driver "github.com/arangodb/go-driver"
33
33
@@ -82,16 +82,16 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
82
82
83
83
// Create deployment
84
84
_ , err := deploymentClient .DatabaseV1alpha ().ArangoDeployments (k8sNameSpace ).Create (deploymentTemplate )
85
- assert .NoError (t , err , fmt .Sprintf ("Create deployment failed: %v" , err ))
85
+ require .NoError (t , err , fmt .Sprintf ("Create deployment failed: %v" , err ))
86
86
87
87
// Wait for deployment to be ready
88
88
deployment , err := waitUntilDeployment (deploymentClient , deploymentTemplate .GetName (), k8sNameSpace , deploymentIsReady ())
89
- assert .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
89
+ require .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
90
90
91
91
// Create a database client
92
92
ctx := context .Background ()
93
93
DBClient := mustNewArangodDatabaseClient (ctx , k8sClient , deployment , t )
94
- assert .NoError (t , waitUntilArangoDeploymentHealthy (deployment , DBClient , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
94
+ require .NoError (t , waitUntilArangoDeploymentHealthy (deployment , DBClient , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
95
95
96
96
// Cleanup
97
97
removeDeployment (deploymentClient , deploymentTemplate .GetName (), k8sNameSpace )
@@ -122,47 +122,49 @@ func TestMultiDeployment(t *testing.T) {
122
122
123
123
// Create deployments
124
124
_ , err := deploymentClient .DatabaseV1alpha ().ArangoDeployments (k8sNameSpace ).Create (deploymentTemplate1 )
125
- assert .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
125
+ require .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
126
126
127
127
_ , err = deploymentClient .DatabaseV1alpha ().ArangoDeployments (k8sNameSpace ).Create (deploymentTemplate2 )
128
- assert .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
128
+ require .NoError (t , err , fmt .Sprintf ("Deployment creation failed: %v" , err ))
129
129
130
130
// Wait for deployments to be ready
131
131
deployment1 , err := waitUntilDeployment (deploymentClient , deploymentTemplate1 .GetName (), k8sNameSpace , deploymentIsReady ())
132
- assert .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
132
+ require .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
- assert .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
135
+ require .NoError (t , err , fmt .Sprintf ("Deployment not running in time: %v" , err ))
136
+
137
+ require .True (t , deployment1 != nil && deployment2 != nil , "deployment is nil" )
136
138
137
139
// Create a database clients
138
140
ctx := context .Background ()
139
141
DBClient1 := mustNewArangodDatabaseClient (ctx , k8sClient , deployment1 , t )
140
- assert .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
142
+ require .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
141
143
DBClient2 := mustNewArangodDatabaseClient (ctx , k8sClient , deployment2 , t )
142
- assert .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
144
+ require .NoError (t , waitUntilArangoDeploymentHealthy (deployment1 , DBClient1 , k8sClient , "" ), fmt .Sprintf ("Deployment not healthy in time: %v" , err ))
143
145
144
146
// Test if we are able to create a collections in both deployments.
145
147
db1 , err := DBClient1 .Database (ctx , "_system" )
146
- assert .NoError (t , err , "failed to get database" )
148
+ require .NoError (t , err , "failed to get database" )
147
149
_ , err = db1 .CreateCollection (ctx , "col1" , nil )
148
- assert .NoError (t , err , "failed to create collection" )
150
+ require .NoError (t , err , "failed to create collection" )
149
151
150
152
db2 , err := DBClient2 .Database (ctx , "_system" )
151
- assert .NoError (t , err , "failed to get database" )
153
+ require .NoError (t , err , "failed to get database" )
152
154
_ , err = db2 .CreateCollection (ctx , "col2" , nil )
153
- assert .NoError (t , err , "failed to create collection" )
155
+ require .NoError (t , err , "failed to create collection" )
154
156
155
157
// The newly created collections must be (only) visible in the deployment
156
158
// that it was created in. The following lines ensure this behavior.
157
159
collections1 , err := db1 .Collections (ctx )
158
- assert .NoError (t , err , "failed to get collections" )
160
+ require .NoError (t , err , "failed to get collections" )
159
161
collections2 , err := db2 .Collections (ctx )
160
- assert .NoError (t , err , "failed to get collections" )
162
+ require .NoError (t , err , "failed to get collections" )
161
163
162
- assert .True (t , containsCollection (collections1 , "col1" ), "collection missing" )
163
- assert .True (t , containsCollection (collections2 , "col2" ), "collection missing" )
164
- assert .False (t , containsCollection (collections1 , "col2" ), "collection must not be in this deployment" )
165
- assert .False (t , containsCollection (collections2 , "col1" ), "collection must not be in this deployment" )
164
+ require .True (t , containsCollection (collections1 , "col1" ), "collection missing" )
165
+ require .True (t , containsCollection (collections2 , "col2" ), "collection missing" )
166
+ require .False (t , containsCollection (collections1 , "col2" ), "collection must not be in this deployment" )
167
+ require .False (t , containsCollection (collections2 , "col1" ), "collection must not be in this deployment" )
166
168
167
169
// Cleanup
168
170
removeDeployment (deploymentClient , deploymentTemplate1 .GetName (), k8sNameSpace )
0 commit comments