@camunda/e2e-test-suite 0.0.997 → 0.0.999
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -63,6 +63,9 @@ async function getUserToken(page) {
|
|
|
63
63
|
// first rejection.
|
|
64
64
|
const TRANSIENT_API_STATUSES = [429, 500, 502, 503, 504];
|
|
65
65
|
const API_MAX_ATTEMPTS = 5;
|
|
66
|
+
// Overrides the global actionTimeout (10s) for Console API calls only: cluster
|
|
67
|
+
// creation regularly needs longer than that to answer.
|
|
68
|
+
const API_TIMEOUT_MS = 15000;
|
|
66
69
|
async function clusterApiRequest(page, method, url, data) {
|
|
67
70
|
let response;
|
|
68
71
|
for (let attempt = 1; attempt <= API_MAX_ATTEMPTS; attempt++) {
|
|
@@ -70,6 +73,7 @@ async function clusterApiRequest(page, method, url, data) {
|
|
|
70
73
|
response = await page.request.fetch(url, {
|
|
71
74
|
method,
|
|
72
75
|
headers: { Authorization: `Bearer ${token}` },
|
|
76
|
+
timeout: API_TIMEOUT_MS,
|
|
73
77
|
...(data === undefined ? {} : { data }),
|
|
74
78
|
});
|
|
75
79
|
if (!TRANSIENT_API_STATUSES.includes(response.status()))
|
|
@@ -110,13 +114,30 @@ async function findClusterByName(page, clusterName) {
|
|
|
110
114
|
return clusters.find((c) => c.name === clusterName);
|
|
111
115
|
}
|
|
112
116
|
async function deleteClusterViaApi(page, clusterName) {
|
|
113
|
-
const cluster = await findClusterByName(page, clusterName);
|
|
114
|
-
if (!cluster)
|
|
115
|
-
return;
|
|
116
117
|
const token = await getUserToken(page);
|
|
117
118
|
const orgId = getOrgId();
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
const deadline = Date.now() + 180000;
|
|
120
|
+
// Re-deleting a cluster that is already terminating can answer 409/400.
|
|
121
|
+
const deleteIssued = new Set();
|
|
122
|
+
// Loop until no cluster carries this name: there can be more than one, and
|
|
123
|
+
// deletion is asynchronous. Leaving one behind means the caller's create adds
|
|
124
|
+
// a duplicate, which breaks clickClusterLink in strict mode.
|
|
125
|
+
while (Date.now() < deadline) {
|
|
126
|
+
const cluster = await findClusterByName(page, clusterName);
|
|
127
|
+
if (!cluster)
|
|
128
|
+
return;
|
|
129
|
+
if (!deleteIssued.has(cluster.uuid)) {
|
|
130
|
+
const response = await page.request.delete(`${getConsoleBaseUrl()}/api/orgs/${orgId}/clusters/${cluster.uuid}`, { headers: { Authorization: `Bearer ${token}` } });
|
|
131
|
+
if (!response.ok() && response.status() !== 404) {
|
|
132
|
+
throw new Error(`Failed to delete cluster "${clusterName}" (${cluster.uuid}): ` +
|
|
133
|
+
`HTTP ${response.status()} - ${await response.text()}`);
|
|
134
|
+
}
|
|
135
|
+
deleteIssued.add(cluster.uuid);
|
|
136
|
+
}
|
|
137
|
+
await (0, sleep_1.sleep)(5000);
|
|
138
|
+
}
|
|
139
|
+
throw new Error(`Cluster "${clusterName}" still listed after 180s; creating another would ` +
|
|
140
|
+
`leave duplicates.`);
|
|
120
141
|
}
|
|
121
142
|
exports.deleteClusterViaApi = deleteClusterViaApi;
|
|
122
143
|
function resolveMinorVersion() {
|