From 08e6dda8e49483f236d140e4df105022b91e70b8 Mon Sep 17 00:00:00 2001 From: Wesley Robert Maffly-Kipp Date: Thu, 16 May 2024 15:59:03 -0700 Subject: [PATCH] tests passing --- cmd/api/src/queries/graph.go | 5 +---- cmd/api/src/queries/graph_integration_test.go | 9 ++++++--- cmd/api/src/test/integration/harnesses.go | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/api/src/queries/graph.go b/cmd/api/src/queries/graph.go index ea975ee936..205c7d5c8c 100644 --- a/cmd/api/src/queries/graph.go +++ b/cmd/api/src/queries/graph.go @@ -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 != "" { diff --git a/cmd/api/src/queries/graph_integration_test.go b/cmd/api/src/queries/graph_integration_test.go index 514a48dde2..adff67d310 100644 --- a/cmd/api/src/queries/graph_integration_test.go +++ b/cmd/api/src/queries/graph_integration_test.go @@ -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) @@ -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)) }) } diff --git a/cmd/api/src/test/integration/harnesses.go b/cmd/api/src/test/integration/harnesses.go index 32827cb14e..a21edc15d4 100644 --- a/cmd/api/src/test/integration/harnesses.go +++ b/cmd/api/src/test/integration/harnesses.go @@ -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 {