Skip to content

Commit ddeeefd

Browse files
test: correctly delete test d1 databases (#9598)
* test: correctly delete test d1 databases * bunch of other tidy-ups and fixes in the e2eCleanup code
1 parent 96f14f6 commit ddeeefd

File tree

3 files changed

+164
-213
lines changed

3 files changed

+164
-213
lines changed

packages/wrangler/e2e/helpers/e2e-wrangler-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ export class WranglerE2ETestHelper {
127127
assert(match !== null, `Cannot find ID in ${JSON.stringify(result)}`);
128128
const id = match[1];
129129
onTestFinished(async () => {
130-
await this.run(`wrangler d1 delete -y ${id}`);
131-
});
130+
await this.run(`wrangler d1 delete -y ${name}`);
131+
}, 15_000);
132132

133133
return { id, name };
134134
}

tools/e2e/__tests__/common.test.ts

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("listTmpE2EProjects()", () => {
4646
.intercept({
4747
path: `/client/v4/accounts/${MOCK_CLOUDFLARE_ACCOUNT_ID}/pages/projects`,
4848
query: {
49-
per_page: 10,
49+
per_page: 100,
5050
page: 1,
5151
},
5252
})
@@ -65,6 +65,13 @@ describe("listTmpE2EProjects()", () => {
6565
{ name: "pages-project-5", created_on: nowStr },
6666
{ name: "pages-project-6", created_on: oldTimeStr },
6767
],
68+
result_info: {
69+
page: 1,
70+
per_page: 10,
71+
count: 10,
72+
total_count: 12,
73+
total_pages: 2,
74+
},
6875
})
6976
);
7077

@@ -73,7 +80,7 @@ describe("listTmpE2EProjects()", () => {
7380
.intercept({
7481
path: `/client/v4/accounts/${MOCK_CLOUDFLARE_ACCOUNT_ID}/pages/projects`,
7582
query: {
76-
per_page: 10,
83+
per_page: 100,
7784
page: 2,
7885
},
7986
})
@@ -84,6 +91,13 @@ describe("listTmpE2EProjects()", () => {
8491
{ name: "tmp-e2e-project-5", created_on: nowStr },
8592
{ name: "tmp-e2e-project-6", created_on: oldTimeStr },
8693
],
94+
result_info: {
95+
page: 2,
96+
per_page: 10,
97+
count: 2,
98+
total_count: 12,
99+
total_pages: 2,
100+
},
87101
})
88102
);
89103

@@ -124,8 +138,6 @@ describe("listTmpKVNamespaces()", () => {
124138
query: {
125139
per_page: 100,
126140
page: 1,
127-
direction: "asc",
128-
order: "title",
129141
},
130142
})
131143
.reply(
@@ -144,6 +156,13 @@ describe("listTmpKVNamespaces()", () => {
144156
{ id: "kv-10", title: "kv-10" },
145157
...Array(90).fill({ id: "kv-10", title: "kv-10" }),
146158
],
159+
result_info: {
160+
page: 1,
161+
per_page: 10,
162+
count: 10,
163+
total_count: 11,
164+
total_pages: 2,
165+
},
147166
})
148167
);
149168
agent
@@ -154,14 +173,19 @@ describe("listTmpKVNamespaces()", () => {
154173
query: {
155174
per_page: 100,
156175
page: 2,
157-
direction: "asc",
158-
order: "title",
159176
},
160177
})
161178
.reply(
162179
200,
163180
JSON.stringify({
164181
result: [{ id: "kv-tmp-e2e-11", title: "kv-11" }],
182+
result_info: {
183+
page: 2,
184+
per_page: 10,
185+
count: 2,
186+
total_count: 12,
187+
total_pages: 2,
188+
},
165189
})
166190
);
167191

@@ -219,6 +243,13 @@ describe("listTmpDatabases()", () => {
219243
created_at: oldTimeStr,
220244
}),
221245
],
246+
result_info: {
247+
page: 1,
248+
per_page: 10,
249+
count: 50,
250+
total_count: 12,
251+
total_pages: 2,
252+
},
222253
})
223254
);
224255
agent
@@ -238,6 +269,13 @@ describe("listTmpDatabases()", () => {
238269
{ uuid: "11", name: "db-11", created_at: nowStr },
239270
{ uuid: "12", name: "db-12", created_at: oldTimeStr },
240271
],
272+
result_info: {
273+
page: 2,
274+
per_page: 10,
275+
count: 2,
276+
total_count: 12,
277+
total_pages: 2,
278+
},
241279
})
242280
);
243281

@@ -274,6 +312,7 @@ describe("listTmpE2EWorkers()", () => {
274312
.get("https://api.cloudflare.com")
275313
.intercept({
276314
path: `/client/v4/accounts/${MOCK_CLOUDFLARE_ACCOUNT_ID}/workers/scripts`,
315+
query: { per_page: 100, page: 1 },
277316
method: "GET",
278317
})
279318
.reply(

0 commit comments

Comments
 (0)