feat: enforce shared application resource quotas across namespaces

This commit is contained in:
2026-09-17 17:57:54 +08:00
parent 5c8825e4bc
commit 993786476e
43 changed files with 1606 additions and 49 deletions

View File

@@ -41,10 +41,16 @@ func executionID(t *testing.T) core.ID {
}
return id
}
func newExecutionFixture(t *testing.T, ctx context.Context, db *sql.DB) *executionFixture {
func newExecutionFixture(t *testing.T, ctx context.Context, db *sql.DB, application ...core.ID) *executionFixture {
t.Helper()
f := &executionFixture{t: t, ctx: ctx, db: db, tasks: service.New(NewTaskStore(db))}
err := Bootstrap(ctx, db, BootstrapInput{Application: "worker-" + string(executionID(t)), Namespace: "default", Environment: "test", Queue: "work"}, func(v BootstrapResult) error { f.resources = v; return nil })
in := BootstrapInput{Application: "worker-" + string(executionID(t)), Namespace: "default", Environment: "test", Queue: "work"}
if len(application) > 0 {
in.Application = ""
in.ExistingApplicationID = application[0]
in.Namespace = "ns-" + string(executionID(t))
}
err := Bootstrap(ctx, db, in, func(v BootstrapResult) error { f.resources = v; return nil })
if err != nil {
t.Fatal(err)
}