diff --git a/internal/neo4j/bolt_integration_test.go b/internal/neo4j/bolt_integration_test.go index d99671d..d9a675c 100644 --- a/internal/neo4j/bolt_integration_test.go +++ b/internal/neo4j/bolt_integration_test.go @@ -78,16 +78,18 @@ func TestIntegration_LazyPushNeverDeletes(t *testing.T) { if err := WriteBolt(ctx, rows, a.Application.ID, seed); err != nil { t.Fatalf("seed: %v", err) } - before, _ := countSubgraph(t, ctx, cfg, a.Application.ID) + before, beforeEdges := countSubgraph(t, ctx, cfg, a.Application.ID) - // A lazy push of an EMPTY row set must delete nothing. - empty := GraphRows{} - if err := WriteBolt(ctx, empty, a.Application.ID, cfg); err != nil { - t.Fatalf("lazy empty push: %v", err) + // A lazy push that has no module rows must delete nothing. It still + // carries the application row: validateIdentity refuses a push without it. + appOnly := GraphRows{Nodes: []NodeRow{appRow(a)}} + if err := WriteBolt(ctx, appOnly, a.Application.ID, cfg); err != nil { + t.Fatalf("lazy application-only push: %v", err) } - after, _ := countSubgraph(t, ctx, cfg, a.Application.ID) - if after < before { - t.Errorf("lazy push deleted nodes: %d -> %d (lazy must be additive-only)", before, after) + after, afterEdges := countSubgraph(t, ctx, cfg, a.Application.ID) + if after < before || afterEdges < beforeEdges { + t.Errorf("lazy push deleted rows: nodes %d -> %d, edges %d -> %d (lazy must be additive-only)", + before, after, beforeEdges, afterEdges) } }