Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: esc10b composition #384

Merged
merged 10 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions cmd/api/src/analysis/ad/adcs_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +1306,6 @@ func TestADCSESC6a(t *testing.T) {
operation.Operation.SubmitReader(func(ctx context.Context, tx graph.Transaction, outC chan<- analysis.CreatePostRelationshipJob) error {
if err := ad2.PostADCSESC6a(ctx, tx, outC, groupExpansions, innerEnterpriseCA, innerDomain, cache); err != nil {
t.Logf("failed post processing for %s: %v", ad.ADCSESC6a.String(), err)
} else {
return nil
}

return nil
Expand Down Expand Up @@ -1341,7 +1339,7 @@ func TestADCSESC6a(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
Expand All @@ -1367,7 +1365,7 @@ func TestADCSESC6a(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6a edges in integration test; %v", err)
} else {
composition, err := ad2.GetADCSESC6aEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)
names := []string{}
for _, node := range composition.AllNodes() {
Expand Down Expand Up @@ -1522,7 +1520,7 @@ func TestADCSESC6b(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6b edge in integration test: %v", err)
} else {
composition, err := ad2.GetADCSESC6bEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)

require.Equal(t, 8, len(composition.AllNodes()))
Expand All @@ -1547,7 +1545,7 @@ func TestADCSESC6b(t *testing.T) {
}).First(); err != nil {
t.Fatalf("error fetching esc6b edge in integration test: %v", err)
} else {
composition, err := ad2.GetADCSESC6bEdgeComposition(context.Background(), db, edge)
composition, err := ad2.GetADCSESC6EdgeComposition(context.Background(), db, edge)
require.Nil(t, err)

require.Equal(t, 8, len(composition.AllNodes()))
Expand Down Expand Up @@ -2229,6 +2227,33 @@ func TestADCSESC10b(t *testing.T) {
}
return nil
})

db.ReadTransaction(context.Background(), func(tx graph.Transaction) error {
if results, err := ops.FetchRelationships(tx.Relationships().Filterf(func() graph.Criteria {
return query.Kind(query.Relationship(), ad.ADCSESC10b)
})); err != nil {
t.Fatalf("error fetching esc10b edges in integration test; %v", err)
} else {
assert.Equal(t, 1, len(results))
edge := results[0]

if edgeComp, err := ad2.GetEdgeCompositionPath(context.Background(), db, edge); err != nil {
t.Fatalf("error getting edge composition for esc10b: %v", err)
} else {
nodes := edgeComp.AllNodes().Slice()
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Group1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Computer1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.Domain1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.NTAuthStore1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.RootCA1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.ComputerDC1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.EnterpriseCA1)
assert.Contains(t, nodes, harness.ESC10bHarnessECA.CertTemplate1)
}
}

return nil
})
})

testContext.DatabaseTestWithSetup(func(harness *integration.HarnessDetails) error {
Expand Down
1 change: 1 addition & 0 deletions packages/cue/bh/ad/ad.cue
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,5 @@ EdgeCompositionRelationships: [
ADCSESC9a,
ADCSESC9b,
ADCSESC10a,
ADCSESC10b,
]
Loading
Loading