Skip to content

Commit bf35dcb

Browse files
committed
For assignment, use status as indicator
1 parent eb7c892 commit bf35dcb

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

dist/clean/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function getAssignmentProgress(floatingIPId, actionId) {
160160

161161
if (res.status === 200) {
162162
const body = await res.json();
163-
return body.action.progress;
163+
return body.action.status;
164164
} else {
165165
core.setFailed(
166166
`When trying to check on the ip's assignment progress, an error occurred: ${
@@ -246,10 +246,10 @@ async function assignIP() {
246246
if (res.status === 201) {
247247
const body = await res.json();
248248

249-
const expectedProgress = 100;
249+
const expectedStatus = "success"
250250
const done = await periodicExecution(
251251
getAssignmentProgress(parsedIPId, body.action.id),
252-
expectedProgress,
252+
expectedStatus,
253253
assignmentTimeout
254254
);
255255

dist/deploy/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function getAssignmentProgress(floatingIPId, actionId) {
165165

166166
if (res.status === 200) {
167167
const body = await res.json();
168-
return body.action.progress;
168+
return body.action.status;
169169
} else {
170170
core.setFailed(
171171
`When trying to check on the ip's assignment progress, an error occurred: ${
@@ -251,10 +251,10 @@ async function assignIP() {
251251
if (res.status === 201) {
252252
const body = await res.json();
253253

254-
const expectedProgress = 100;
254+
const expectedStatus = "success"
255255
const done = await periodicExecution(
256256
getAssignmentProgress(parsedIPId, body.action.id),
257-
expectedProgress,
257+
expectedStatus,
258258
assignmentTimeout
259259
);
260260

lib.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function getAssignmentProgress(floatingIPId, actionId) {
131131

132132
if (res.status === 200) {
133133
const body = await res.json();
134-
return body.action.progress;
134+
return body.action.status;
135135
} else {
136136
core.setFailed(
137137
`When trying to check on the ip's assignment progress, an error occurred: ${
@@ -217,10 +217,10 @@ async function assignIP() {
217217
if (res.status === 201) {
218218
const body = await res.json();
219219

220-
const expectedProgress = 100;
220+
const expectedStatus = "success"
221221
const done = await periodicExecution(
222222
getAssignmentProgress(parsedIPId, body.action.id),
223-
expectedProgress,
223+
expectedStatus,
224224
assignmentTimeout
225225
);
226226

test/index_test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,14 @@ test("if assigning a floating IP to a server is possible", async t => {
256256
res.status(200).json({
257257
action: {
258258
id: actionId,
259-
progress: 50
259+
status: "running"
260260
}
261261
});
262262
} else if (c === 1) {
263263
res.status(200).json({
264264
action: {
265265
id: actionId,
266-
progress: 100
266+
status: "success"
267267
}
268268
});
269269
}
@@ -315,14 +315,14 @@ test("if assigning a floating IP to a server is possible", async t => {
315315
t.pass();
316316
});
317317

318-
test("getting the progress of assigning a floating IP", async t => {
318+
test("getting the status of assigning a floating IP", async t => {
319319
const worker = await createWorker(`
320320
const actionId = 4321;
321321
app.get("/floating_ips/:floatingIPId/actions/:actionId", (req, res) => {
322322
return res.status(200).json({
323323
action: {
324324
id: actionId,
325-
progress: 50
325+
status: "success"
326326
}
327327
});
328328
});
@@ -333,8 +333,8 @@ test("getting the progress of assigning a floating IP", async t => {
333333
}
334334
});
335335

336-
const progress = await getAssignmentProgress(1234, 4321)();
337-
t.assert(progress === 50);
336+
const status = await getAssignmentProgress(1234, 4321)();
337+
t.assert(status === "success");
338338
});
339339

340340
test("getting a floating ip", async t => {

0 commit comments

Comments
 (0)