Skip to content

Commit

Permalink
tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
maffkipp committed May 16, 2024
1 parent 15c2fc2 commit 08e6dda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 1 addition & 4 deletions cmd/api/src/queries/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ func (s *GraphQuery) GetAssetGroupComboNode(ctx context.Context, owningObjectID
if assetGroupNodes, err := ops.FetchNodeSet(tx.Nodes().Filterf(func() graph.Criteria {
filters := []graph.Criteria{
query.KindIn(query.Node(), azure.Entity, ad.Entity),
query.Or(
query.StringContains(query.NodeProperty(common.SystemTags.String()), assetGroupTag),
query.StringContains(query.NodeProperty(common.UserTags.String()), assetGroupTag),
),
query.StringContains(query.NodeProperty(common.SystemTags.String()), assetGroupTag),
}

if owningObjectID != "" {
Expand Down
9 changes: 6 additions & 3 deletions cmd/api/src/queries/graph_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ func TestGetAssetGroupComboNode(t *testing.T) {

func TestGetAssetGroupNodes(t *testing.T) {
testContext := integration.NewGraphTestContext(t, schema.DefaultGraphSchema())
testContext.DatabaseTest(func(harness integration.HarnessDetails, db graph.Database) {
testContext.DatabaseTestWithSetup(func(harness *integration.HarnessDetails) error {
harness.AssetGroupNodesHarness.Setup(testContext)
return nil
}, func(harness integration.HarnessDetails, db graph.Database) {
graphQuery := queries.NewGraphQuery(db, cache.Cache{}, config.Configuration{})

tierZeroNodes, err := graphQuery.GetAssetGroupNodes(context.Background(), ad.AdminTierZero)
Expand All @@ -302,8 +305,8 @@ func TestGetAssetGroupNodes(t *testing.T) {
require.True(t, tierZeroNodes.Contains(harness.AssetGroupNodesHarness.GroupC))
require.Equal(t, 2, len(tierZeroNodes))

require.Contains(t, customGroupNodes, harness.AssetGroupNodesHarness.GroupD)
require.Contains(t, customGroupNodes, harness.AssetGroupNodesHarness.GroupE)
require.True(t, customGroupNodes.Contains(harness.AssetGroupNodesHarness.GroupD))
require.True(t, customGroupNodes.Contains(harness.AssetGroupNodesHarness.GroupE))
require.Equal(t, 2, len(customGroupNodes))
})
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/api/src/test/integration/harnesses.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,11 @@ func (s *AssetGroupNodesHarness) Setup(testCtx *GraphTestContext) {
s.GroupC.Properties.Set(common.SystemTags.String(), ad.AdminTierZero)
s.GroupD.Properties.Set(common.UserTags.String(), "custom_tag")
s.GroupE.Properties.Set(common.UserTags.String(), "custom_tag another_tag")

testCtx.UpdateNode(s.GroupB)
testCtx.UpdateNode(s.GroupC)
testCtx.UpdateNode(s.GroupD)
testCtx.UpdateNode(s.GroupE)
}

type InboundControlHarness struct {
Expand Down

0 comments on commit 08e6dda

Please sign in to comment.