GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test(combos): resolve cooled accounts by id, not by filtered position · lidge-jun/opencodex@e8ee8a8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tests/adapters/anthropic
    • anthropic-combo-account-cooldown.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/adapters/anthropic/anthropic-combo-account-cooldown.test.ts‎

Copy file name to clipboardExpand all lines: tests/adapters/anthropic/anthropic-combo-account-cooldown.test.ts
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,16 @@ test("a spent pool account does not cool the combo target for the accounts that
146146
expect(served.status).toBe(200);
147147
// The retry left through an account the first request had not spent.
148148
expect(sentTokens.length).toBeGreaterThan(0);
149-
const cooledTokens = cooled.map((_, index) => `Bearer ${credential(index).access}`);
149+
// Map each COOLED id back to its own token. `cooled` is a filtered subset of `ids`, so its
150+
// positions are not account indexes: with accounts 0 and 2 cooled, indexing by position would
151+
// check tokens 0 and 1 and let a retry through cooled account 2 unnoticed.
152+
const cooledTokens = cooled.map(id => `Bearer ${credential(ids.indexOf(id)).access}`);
150153
expect(cooledTokens).not.toContain(sentTokens[0]!);
154+
// Stated the other way round, from the token actually sent: resolve it back to its account and
155+
// assert that account is one the first request never cooled.
156+
const servedIndex = ids.findIndex((_, index) => sentTokens[0] === `Bearer ${credential(index).access}`);
157+
expect(servedIndex).toBeGreaterThanOrEqual(0);
158+
expect(cooled).not.toContain(ids[servedIndex]!);
151159
}, 20_000);
152160

153161
test("every pool account spent still cools the combo target", async () => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.