@@ -27,7 +27,7 @@ import (
2727 "testing"
2828
2929 "github.com/dchest/uniuri"
30- "github.com/stretchr/testify/assert "
30+ "github.com/stretchr/testify/require "
3131
3232 driver "github.com/arangodb/go-driver"
3333
@@ -82,16 +82,16 @@ func deploymentSubTest(t *testing.T, mode api.DeploymentMode, engine api.Storage
8282
8383 // Create deployment
8484 _ , 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 ))
8686
8787 // Wait for deployment to be ready
8888 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 ))
9090
9191 // Create a database client
9292 ctx := context .Background ()
9393 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 ))
9595
9696 // Cleanup
9797 removeDeployment (deploymentClient , deploymentTemplate .GetName (), k8sNameSpace )
@@ -122,47 +122,49 @@ func TestMultiDeployment(t *testing.T) {
122122
123123 // Create deployments
124124 _ , 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 ))
126126
127127 _ , 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 ))
129129
130130 // Wait for deployments to be ready
131131 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 ))
133133
134134 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" )
136138
137139 // Create a database clients
138140 ctx := context .Background ()
139141 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 ))
141143 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 ))
143145
144146 // Test if we are able to create a collections in both deployments.
145147 db1 , err := DBClient1 .Database (ctx , "_system" )
146- assert .NoError (t , err , "failed to get database" )
148+ require .NoError (t , err , "failed to get database" )
147149 _ , err = db1 .CreateCollection (ctx , "col1" , nil )
148- assert .NoError (t , err , "failed to create collection" )
150+ require .NoError (t , err , "failed to create collection" )
149151
150152 db2 , err := DBClient2 .Database (ctx , "_system" )
151- assert .NoError (t , err , "failed to get database" )
153+ require .NoError (t , err , "failed to get database" )
152154 _ , err = db2 .CreateCollection (ctx , "col2" , nil )
153- assert .NoError (t , err , "failed to create collection" )
155+ require .NoError (t , err , "failed to create collection" )
154156
155157 // The newly created collections must be (only) visible in the deployment
156158 // that it was created in. The following lines ensure this behavior.
157159 collections1 , err := db1 .Collections (ctx )
158- assert .NoError (t , err , "failed to get collections" )
160+ require .NoError (t , err , "failed to get collections" )
159161 collections2 , err := db2 .Collections (ctx )
160- assert .NoError (t , err , "failed to get collections" )
162+ require .NoError (t , err , "failed to get collections" )
161163
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" )
166168
167169 // Cleanup
168170 removeDeployment (deploymentClient , deploymentTemplate1 .GetName (), k8sNameSpace )
0 commit comments