@@ -178,3 +178,136 @@ func Test_Graph_AdvancedCreate_Defaults(t *testing.T) {
178178 }
179179 })
180180}
181+
182+ func TestGraphCreation (t * testing.T ) {
183+ // Arrange
184+ ctx := context .Background ()
185+
186+ c := createClientFromEnv (t , true )
187+ EnsureVersion (t , ctx , c ).MinimumVersion ("3.7.0" ).Cluster ().Enterprise ()
188+
189+ t .Run ("Satellite" , func (t * testing.T ) {
190+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
191+
192+ // Create
193+ graphID := db .Name () + "_graph"
194+
195+ options , collections := newGraphOpts (db )
196+
197+ options .ReplicationFactor = driver .SatelliteGraph
198+
199+ g , err := db .CreateGraph (ctx , graphID , & options )
200+ require .NoError (t , err )
201+
202+ // Wait for collections to be created
203+ waitForCollections (t , db , collections )
204+
205+ require .True (t , g .IsSatellite ())
206+ })
207+
208+ t .Run ("Satellite - list" , func (t * testing.T ) {
209+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
210+
211+ // Create
212+ graphID := db .Name () + "_graph"
213+
214+ options , collections := newGraphOpts (db )
215+
216+ options .ReplicationFactor = driver .SatelliteGraph
217+
218+ g , err := db .CreateGraph (ctx , graphID , & options )
219+ require .NoError (t , err )
220+
221+ // Wait for collections to be created
222+ waitForCollections (t , db , collections )
223+
224+ graphs , err := db .Graphs (ctx )
225+ require .NoError (t , err )
226+ require .Len (t , graphs , 1 )
227+
228+ require .Equal (t , g .Name (), graphs [0 ].Name ())
229+ require .True (t , graphs [0 ].IsSatellite ())
230+ })
231+
232+ t .Run ("Standard" , func (t * testing.T ) {
233+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
234+
235+ // Create
236+ graphID := db .Name () + "_graph"
237+
238+ options , collections := newGraphOpts (db )
239+
240+ g , err := db .CreateGraph (ctx , graphID , & options )
241+ require .NoError (t , err )
242+
243+ // Wait for collections to be created
244+ waitForCollections (t , db , collections )
245+
246+ require .False (t , g .IsSatellite ())
247+ })
248+
249+ t .Run ("Standard - list" , func (t * testing.T ) {
250+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
251+
252+ // Create
253+ graphID := db .Name () + "_graph"
254+
255+ options , collections := newGraphOpts (db )
256+
257+ g , err := db .CreateGraph (ctx , graphID , & options )
258+ require .NoError (t , err )
259+
260+ // Wait for collections to be created
261+ waitForCollections (t , db , collections )
262+
263+ graphs , err := db .Graphs (ctx )
264+ require .NoError (t , err )
265+ require .Len (t , graphs , 1 )
266+
267+ require .Equal (t , g .Name (), graphs [0 ].Name ())
268+ require .False (t , graphs [0 ].IsSatellite ())
269+ })
270+
271+ t .Run ("Disjoint" , func (t * testing.T ) {
272+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
273+
274+ // Create
275+ graphID := db .Name () + "_graph"
276+
277+ options , collections := newGraphOpts (db )
278+
279+ options .IsDisjoint = true
280+
281+ g , err := db .CreateGraph (ctx , graphID , & options )
282+ require .NoError (t , err )
283+
284+ // Wait for collections to be created
285+ waitForCollections (t , db , collections )
286+
287+ require .True (t , g .IsDisjoint ())
288+ })
289+
290+ t .Run ("Disjoint - list" , func (t * testing.T ) {
291+ db := ensureDatabase (ctx , c , databaseName ("graph" , "create" , "defaults" ), nil , t )
292+
293+ // Create
294+ graphID := db .Name () + "_graph"
295+
296+ options , collections := newGraphOpts (db )
297+
298+ options .IsDisjoint = true
299+
300+ g , err := db .CreateGraph (ctx , graphID , & options )
301+ require .NoError (t , err )
302+
303+ // Wait for collections to be created
304+ waitForCollections (t , db , collections )
305+
306+ graphs , err := db .Graphs (ctx )
307+ require .NoError (t , err )
308+ require .Len (t , graphs , 1 )
309+
310+ require .Equal (t , g .Name (), graphs [0 ].Name ())
311+ require .True (t , graphs [0 ].IsDisjoint ())
312+ })
313+ }
0 commit comments