| index cb945dd4c..3458d3fd2 100644 |
| --- a/internal/console/perfwalk_test.go |
| +++ b/internal/console/perfwalk_test.go |
| @@ -84,7 +84,10 @@ const ( |
| // a path, and the walk's in-flight counter, keyed by fixture. |
| type perfSeeds struct { |
| invite, emailLink string |
| - inflight *atomic.Int32 |
| + // lapsed is the sqid of the account seeded on the lapse path, for |
| + // the keep page. |
| + lapsed string |
| + inflight *atomic.Int32 |
| } |
| |
| var perfSeeded sync.Map // *consoleFixture -> *perfSeeds |
| @@ -327,6 +330,12 @@ func perfSeed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) { |
| } |
| } |
| |
| + // A plan catalogue, so the plan pages are live, and an account paul |
| + // owns on the lapse path for the keep page: two apps and three |
| + // instance records, free for eight days after paying, so the grace |
| + // pass has turned the two newest off (keepFixture's shape). |
| + perfSeedLapsed(t, fx, seeds) |
| + |
| // Every object was written seconds ago, and readers that trust an |
| // object's stamp only once it has settled (domains.ClaimCache's |
| // modSettle, two seconds) would re-read them for the first moments of |
| @@ -339,6 +348,36 @@ func perfSeed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) { |
| perfSeedGoneBoxes(t, fx, 1100) |
| } |
| |
| +// perfSeedLapsed turns the plan catalogue on and seeds the lapsed |
| +// account the keep page lists. |
| +func perfSeedLapsed(t *testing.T, fx *consoleFixture, seeds *perfSeeds) { |
| + t.Helper() |
| + fx.srv.cfg.PlanCatalog = examplePlanCatalog(t) |
| + acct := planAccount(t, fx, 501) |
| + if err := fx.st.AddMember(acct.ID, "paul@keymail.dev", RoleOwner, time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + // The grace pass mails the account's owners its notice: to a fake |
| + // for the seeding only, so the walk's pages run on the console's own |
| + // mail wiring. |
| + prevMail, prevFederated := fx.srv.consoleMail, fx.srv.sendFederated |
| + fx.srv.consoleMail, fx.srv.sendFederated = &fakeConsoleMail{ready: true}, nil |
| + defer func() { fx.srv.consoleMail, fx.srv.sendFederated = prevMail, prevFederated }() |
| + base := time.Now().Add(-8 * 24 * time.Hour) |
| + lapseApp_(t, fx, acct, "shop", base.Add(-100*time.Hour)) |
| + lapseInstanceRec(t, fx, acct, "shop", "shop-1.example.com", base.Add(-99*time.Hour)) |
| + lapseApp_(t, fx, acct, "blog", base.Add(-98*time.Hour)) |
| + lapseInstanceRec(t, fx, acct, "blog", "blog-1.example.com", base.Add(-97*time.Hour)) |
| + lapseInstanceRec(t, fx, acct, "shop", "shop-2.example.com", base.Add(-96*time.Hour)) |
| + applyPlan(t, fx, acct, "personal", nil, nil, base.Add(-time.Hour)) |
| + applyPlan(t, fx, acct, "free", nil, nil, base) |
| + fx.srv.planGracePass(context.Background(), time.Now()) |
| + if got, want := disabledOf(t, fx, acct), []string{"blog-1.example.com", "shop-2.example.com"}; !slices.Equal(got, want) { |
| + t.Fatalf("perf fixture: the lapsed account's disabled = %v, want %v", got, want) |
| + } |
| + seeds.lapsed = acct.Sqid |
| +} |
| + |
| // perfAgeObjects sets every object's modification time in the fixture's |
| // DirStore back by age. |
| func perfAgeObjects(t *testing.T, fx *consoleFixture, age time.Duration) { |
| @@ -415,6 +454,7 @@ func perfTargets(fx *consoleFixture) map[string][]perfTarget { |
| "GET /a/{sqid}/trash": ok(fx.path("/trash")), |
| "GET /a/{sqid}/apps/{app}": ok(app), |
| "GET /a/{sqid}/apps/{app}/instances/{host}": ok(app + "/instances/kass.carlosapp.dev"), |
| + "GET /a/{sqid}/plan/keep": ok("/a/" + seeds.lapsed + "/plan/keep"), |
| } |
| for _, tab := range []string{"account-review", "activity", "analytics", "availability", "deployments", "errors", |
| "instances", "logs", "logs/data", "pipeline", "releases", "settings"} { |