From 4257afad1b65dc8ff715d99e7a325fa55c2d3e53 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 7 Jul 2020 07:27:12 +0200 Subject: [PATCH] Adapt expected response of advanced settings feature control for cloud tests (#70793) --- .../advanced_settings/feature_controls.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts b/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts index 77e23bd74cc22..7a0d0fe2f5d48 100644 --- a/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts +++ b/x-pack/test/api_integration/apis/management/advanced_settings/feature_controls.ts @@ -21,9 +21,16 @@ export default function featureControlsTests({ getService }: FtrProviderContext) }; const expectResponse = (result: any) => { - expect(result.error).to.be(undefined); - expect(result.response).not.to.be(undefined); - expect(result.response).to.have.property('statusCode', 200); + if (result.response && result.response.statusCode === 400) { + // expect a change of telemetry settings to fail in cloud environment + expect(result.response.body.message).to.be( + '{"error":"Not allowed to change Opt-in Status."}' + ); + } else { + expect(result.error).to.be(undefined); + expect(result.response).not.to.be(undefined); + expect(result.response).to.have.property('statusCode', 200); + } }; async function saveAdvancedSetting(username: string, password: string, spaceId?: string) {