Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Ignore all DO errors during onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoqin-github committed Nov 19, 2019
1 parent 735b061 commit ce52593
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
14 changes: 3 additions & 11 deletions app/waf/src/services/do.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,9 @@ export class OnboardingManager {
return resObj[0]['result']['code'] === 200;
},
reason => {
// Wait for iControl LX restarting, ignore 404, 502 and 503
if (reason.statusCode === 404 || reason.statusCode > 500) {
return false;
}

// if onboarding fails.
let mesg =
'Failed to query onboarding status: ' + JSON.stringify(reason);
this.logger.error(mesg);
// quit immediately
return Promise.reject(mesg);
// Ignore all errors, because iControl LX is restarting
this.logger.warn(`DO error: ${reason}`);
return false;
},
);
}
Expand Down
6 changes: 2 additions & 4 deletions app/waf/test/acceptance/adc.controller.acceptance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1825,13 +1825,11 @@ describe('AdcController test', () => {

await checkAndWait(checkStatus, 200, [], 5).then(() => {});
expect(response.body.adc.status).eql('ONBOARDERROR');
expect(response.body.adc.lastErr).startWith(
'ONBOARDERROR: Failed to query onboarding status:',
);
expect(response.body.adc.lastErr).startWith('ONBOARDERROR: timeout');
expect(response.body.adc.management.connection.rootPass).not.eql('default');

restoreConsoleLog();
});
}).timeout(5000);

it('post ' + prefix + '/adcs: onboard timeout', async () => {
let adc = createAdcObject({
Expand Down
3 changes: 1 addition & 2 deletions app/waf/test/unit/service.OnboardingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ describe('test OnboardingManager', async () => {

try {
await doMgr.isDone(ExpectedData.doTaskId);
expect('call').eql('should not happen.');
} catch (error) {
expect(error).startWith('Failed to query onboarding status: ');
expect('call').eql('should not happen.');
}
});
});

0 comments on commit ce52593

Please sign in to comment.