2019-12-24 10:31:18 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2019-12-24 10:31:18 +01:00
|
|
|
*/
|
2021-02-04 03:12:39 +01:00
|
|
|
|
2019-12-24 10:31:18 +01:00
|
|
|
import expect from '@kbn/expect';
|
|
|
|
import { FtrProviderContext } from '../services';
|
|
|
|
import { LicensingPluginSetup } from '../../../plugins/licensing/public';
|
|
|
|
import { createScenario } from '../scenario';
|
|
|
|
import '../../../../test/plugin_functional/plugins/core_provider_plugin/types';
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
2020-05-22 09:08:58 +02:00
|
|
|
export default function (ftrContext: FtrProviderContext) {
|
2019-12-24 10:31:18 +01:00
|
|
|
const { getService } = ftrContext;
|
|
|
|
const testSubjects = getService('testSubjects');
|
|
|
|
const browser = getService('browser');
|
|
|
|
|
|
|
|
const scenario = createScenario(ftrContext);
|
|
|
|
|
2021-04-21 14:38:14 +02:00
|
|
|
// FLAKY: https://github.com/elastic/kibana/issues/53575
|
|
|
|
describe.skip('changes in license types', () => {
|
2019-12-24 10:31:18 +01:00
|
|
|
after(async () => {
|
|
|
|
await scenario.teardown();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('provides changes in license types', async () => {
|
|
|
|
await scenario.setup();
|
|
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
|
|
|
|
expect(
|
2020-06-15 15:32:08 +02:00
|
|
|
await browser.executeAsync(async (cb) => {
|
2020-08-05 17:32:19 +02:00
|
|
|
const { setup, testUtils } = window._coreProvider;
|
2019-12-24 10:31:18 +01:00
|
|
|
// this call enforces signature check to detect license update
|
|
|
|
// and causes license re-fetch
|
|
|
|
await setup.core.http.get('/');
|
2021-04-21 05:44:24 +02:00
|
|
|
await testUtils.delay(1000);
|
2019-12-24 10:31:18 +01:00
|
|
|
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
2020-05-22 09:08:58 +02:00
|
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
2019-12-24 10:31:18 +01:00
|
|
|
})
|
|
|
|
).to.be('basic');
|
|
|
|
|
|
|
|
// license hasn't changed
|
|
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
|
|
|
|
expect(
|
2020-06-15 15:32:08 +02:00
|
|
|
await browser.executeAsync(async (cb) => {
|
2020-08-05 17:32:19 +02:00
|
|
|
const { setup, testUtils } = window._coreProvider;
|
2019-12-24 10:31:18 +01:00
|
|
|
// this call enforces signature check to detect license update
|
|
|
|
// and causes license re-fetch
|
|
|
|
await setup.core.http.get('/');
|
2021-04-21 05:44:24 +02:00
|
|
|
await testUtils.delay(1000);
|
2019-12-24 10:31:18 +01:00
|
|
|
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
2020-05-22 09:08:58 +02:00
|
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
2019-12-24 10:31:18 +01:00
|
|
|
})
|
|
|
|
).to.be('basic');
|
|
|
|
|
|
|
|
await scenario.startTrial();
|
|
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
|
|
|
|
expect(
|
2020-06-15 15:32:08 +02:00
|
|
|
await browser.executeAsync(async (cb) => {
|
2020-08-05 17:32:19 +02:00
|
|
|
const { setup, testUtils } = window._coreProvider;
|
2019-12-24 10:31:18 +01:00
|
|
|
// this call enforces signature check to detect license update
|
|
|
|
// and causes license re-fetch
|
|
|
|
await setup.core.http.get('/');
|
2021-04-21 05:44:24 +02:00
|
|
|
await testUtils.delay(1000);
|
2019-12-24 10:31:18 +01:00
|
|
|
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
2020-05-22 09:08:58 +02:00
|
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
2019-12-24 10:31:18 +01:00
|
|
|
})
|
|
|
|
).to.be('trial');
|
|
|
|
|
|
|
|
await scenario.startBasic();
|
|
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
|
|
|
|
expect(
|
2020-06-15 15:32:08 +02:00
|
|
|
await browser.executeAsync(async (cb) => {
|
2020-08-05 17:32:19 +02:00
|
|
|
const { setup, testUtils } = window._coreProvider;
|
2019-12-24 10:31:18 +01:00
|
|
|
// this call enforces signature check to detect license update
|
|
|
|
// and causes license re-fetch
|
|
|
|
await setup.core.http.get('/');
|
2021-04-21 05:44:24 +02:00
|
|
|
await testUtils.delay(1000);
|
2019-12-24 10:31:18 +01:00
|
|
|
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
2020-05-22 09:08:58 +02:00
|
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
2019-12-24 10:31:18 +01:00
|
|
|
})
|
|
|
|
).to.be('basic');
|
|
|
|
|
|
|
|
// banner shown only when license expired not just deleted
|
|
|
|
await testSubjects.missingOrFail('licenseExpiredBanner');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|