test: 公司归属测试结束删公司,修复 CI 重试跨轮污染
This commit is contained in:
1 parent
99ea805880
commit
f8454d310b
1 file changed
+5
@@ -342,6 +342,11 @@ func TestCompanyScopeAttribution(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("UpsertCompany: %v", err)
|
t.Fatalf("UpsertCompany: %v", err)
|
||||||
}
|
}
|
||||||
|
// 公司名每轮唯一,但 CIDR(198.51.100.0/24)是硬编码的。CI 重试会复用同一个库,
|
||||||
|
// 若不删公司,上一轮留下的 scope 行会和本轮争夺同一网段——IP 归属按 company_id 升序
|
||||||
|
// 取第一个,于是落到上一轮那个更小的 id 上(曾现 company_id=26, want 64)。删公司会
|
||||||
|
// 级联清掉 company_scope,让重试从干净状态开始。LIFO:本清理先于上面的删资产+关库跑。
|
||||||
|
t.Cleanup(func() { _ = cs.DeleteCompany(cid) })
|
||||||
|
|
||||||
// a pre-existing asset (inserted BEFORE any scope) — must be back-filled.
|
// a pre-existing asset (inserted BEFORE any scope) — must be back-filled.
|
||||||
preID, err := as.UpsertSubdomain(UpsertSubdomainReq{Domain: sub})
|
preID, err := as.UpsertSubdomain(UpsertSubdomainReq{Domain: sub})
|
||||||
|
|||||||
Reference in new issue
Block a user