b2040a5a1b
* Update @typescript-eslint to ensure compatibility with TypeScript v3.9 (#74091) * bump @typescript-eslint deps * update rules * fix errors in pacakges * fix src/ * fix x-pack * fix test * fix typings * fix examples * allow _ as prefix and suffix * roll back prefix and suffix changes * add eslint-plugin-eslint-comments * report unused rules * remove unused eslint comments from tests * remove unused eslint comments 2nd pass * remove unused eslint comments from src/ * remove unused comments in x-pack * use no-script-url and no-unsanitized/property for ts files * remove unused eslint comments * eui/href-or-on-click removed when not complained * no import/* rules for ts files * cleanup * remove the unused eslint-disable * rollback unnecessary changes * allow underscore prefix & sufix in type name * update docs * fix type error in enterprise search plugin mocks * rename platform hack __coreProvider --> _coreProvider * rollback space removal in src/core/public/legacy/legacy_service.test.ts * fix naming convention in APM # Conflicts: # src/legacy/ui/public/new_platform/new_platform.ts # x-pack/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx * remove unnecessary comment
94 lines
3.4 KiB
TypeScript
94 lines
3.4 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
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
|
|
export default function (ftrContext: FtrProviderContext) {
|
|
const { getService } = ftrContext;
|
|
const testSubjects = getService('testSubjects');
|
|
const browser = getService('browser');
|
|
|
|
const scenario = createScenario(ftrContext);
|
|
|
|
describe('changes in license types', () => {
|
|
after(async () => {
|
|
await scenario.teardown();
|
|
});
|
|
|
|
it('provides changes in license types', async () => {
|
|
await scenario.setup();
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
expect(
|
|
await browser.executeAsync(async (cb) => {
|
|
const { setup, testUtils } = window._coreProvider;
|
|
// this call enforces signature check to detect license update
|
|
// and causes license re-fetch
|
|
await setup.core.http.get('/');
|
|
await testUtils.delay(500);
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
|
})
|
|
).to.be('basic');
|
|
|
|
// license hasn't changed
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
expect(
|
|
await browser.executeAsync(async (cb) => {
|
|
const { setup, testUtils } = window._coreProvider;
|
|
// this call enforces signature check to detect license update
|
|
// and causes license re-fetch
|
|
await setup.core.http.get('/');
|
|
await testUtils.delay(500);
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
|
})
|
|
).to.be('basic');
|
|
|
|
await scenario.startTrial();
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
expect(
|
|
await browser.executeAsync(async (cb) => {
|
|
const { setup, testUtils } = window._coreProvider;
|
|
// this call enforces signature check to detect license update
|
|
// and causes license re-fetch
|
|
await setup.core.http.get('/');
|
|
await testUtils.delay(500);
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
|
})
|
|
).to.be('trial');
|
|
|
|
await scenario.startBasic();
|
|
await scenario.waitForPluginToDetectLicenseUpdate();
|
|
|
|
expect(
|
|
await browser.executeAsync(async (cb) => {
|
|
const { setup, testUtils } = window._coreProvider;
|
|
// this call enforces signature check to detect license update
|
|
// and causes license re-fetch
|
|
await setup.core.http.get('/');
|
|
await testUtils.delay(500);
|
|
|
|
const licensing: LicensingPluginSetup = setup.plugins.licensing;
|
|
licensing.license$.subscribe((license) => cb(license.type));
|
|
})
|
|
).to.be('basic');
|
|
|
|
// banner shown only when license expired not just deleted
|
|
await testSubjects.missingOrFail('licenseExpiredBanner');
|
|
});
|
|
});
|
|
}
|