Skip to content

Commit

Permalink
GT-181 Add tests to check support for Enterprise Graphs (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo committed Aug 29, 2022
1 parent 95925b1 commit eeb1782
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Add support for Inverted index
- Deprecate fulltext index
- Add support for Pregel API
- Add tests to check support for Enterprise Graphs

## [1.3.3](https://github.com/arangodb/go-driver/tree/v1.3.3) (2022-07-27)
- Fix `lastValue` field type
Expand Down
4 changes: 2 additions & 2 deletions graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ type Graph interface {
// IsDisjoint return information if graph have isDisjoint flag set to true
IsDisjoint() bool

// Edge collection functions
// GraphEdgeCollections Edge collection functions
GraphEdgeCollections

// Vertex collection functions
// GraphVertexCollections Vertex collection functions
GraphVertexCollections

// ID returns the id of the graph.
Expand Down
56 changes: 56 additions & 0 deletions test/graph_creation_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,59 @@ func TestHybridSmartGraphCreationV2(t *testing.T) {
}
}
}

func TestHybridSmartGraphCreationConditions(t *testing.T) {
ctx := context.Background()

c := createClientFromEnv(t, true)
EnsureVersion(t, ctx, c).CheckVersion(MinimumVersion("3.10.0")).Cluster().Enterprise()

db := ensureDatabase(ctx, c, databaseName("graph", "create", "hybrid", "options"), nil, t)

t.Run("General Graph - isSmart is False and no smartGraphAttribute", func(t *testing.T) {
graphID := db.Name() + "_graph_smart_no_conditions"

options := driver.CreateGraphOptions{
IsSmart: false,
SmartGraphAttribute: "",
}
g, err := db.CreateGraphV2(ctx, graphID, &options)
require.NoErrorf(t, err, "Failed to create graph '%s': %s", graphID, describe(err))

require.Equal(t, g.Name(), graphID)
require.Empty(t, g.SmartGraphAttribute())
require.False(t, g.IsSmart())
})

t.Run("Smart Graph - isSmart is True and smartGraphAttribute exist", func(t *testing.T) {
graphID := db.Name() + "_graph_smart_conditions"

options := driver.CreateGraphOptions{
IsSmart: true,
SmartGraphAttribute: "test",
}
g, err := db.CreateGraphV2(ctx, graphID, &options)
require.NoErrorf(t, err, "Failed to create graph '%s': %s", graphID, describe(err))

require.Equal(t, g.Name(), graphID)
require.NotEmpty(t, g.SmartGraphAttribute())
require.True(t, g.IsSmart())
})

t.Run("Enterprise Graph - isSmart is True and no smartGraphAttribute", func(t *testing.T) {
skipBelowVersion(c, "3.10", t)

graphID := db.Name() + "_graph_smart_conditions_no_attribute"

options := driver.CreateGraphOptions{
IsSmart: true,
SmartGraphAttribute: "",
}
g, err := db.CreateGraphV2(ctx, graphID, &options)
require.NoErrorf(t, err, "Failed to create graph '%s': %s", graphID, describe(err))

require.Equal(t, g.Name(), graphID)
require.Empty(t, g.SmartGraphAttribute())
require.True(t, g.IsSmart())
})
}

0 comments on commit eeb1782

Please sign in to comment.