From ce525930f83d5caa63eb71362c30e57686766a55 Mon Sep 17 00:00:00 2001 From: Qin Zhao Date: Tue, 19 Nov 2019 13:51:02 +0800 Subject: [PATCH] Ignore all DO errors during onboarding --- app/waf/src/services/do.service.ts | 14 +++----------- .../test/acceptance/adc.controller.acceptance.ts | 6 ++---- app/waf/test/unit/service.OnboardingManager.ts | 3 +-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/app/waf/src/services/do.service.ts b/app/waf/src/services/do.service.ts index dba35846f..a199dcde7 100644 --- a/app/waf/src/services/do.service.ts +++ b/app/waf/src/services/do.service.ts @@ -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; }, ); } diff --git a/app/waf/test/acceptance/adc.controller.acceptance.ts b/app/waf/test/acceptance/adc.controller.acceptance.ts index 2236828df..3aeb5c277 100644 --- a/app/waf/test/acceptance/adc.controller.acceptance.ts +++ b/app/waf/test/acceptance/adc.controller.acceptance.ts @@ -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({ diff --git a/app/waf/test/unit/service.OnboardingManager.ts b/app/waf/test/unit/service.OnboardingManager.ts index fec51864a..85c53b8f9 100644 --- a/app/waf/test/unit/service.OnboardingManager.ts +++ b/app/waf/test/unit/service.OnboardingManager.ts @@ -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.'); } }); });