-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 3 scenario for licensing plugins: server, client, legacy
- Loading branch information
Showing
13 changed files
with
436 additions
and
181 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* 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 { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
|
||
export default async function({ readConfigFile }: FtrConfigProviderContext) { | ||
const commonConfig = await readConfigFile(require.resolve('./config')); | ||
|
||
return { | ||
...commonConfig.getAll(), | ||
testFiles: [require.resolve('./legacy')], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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 path from 'path'; | ||
import { KIBANA_ROOT } from '@kbn/test'; | ||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
|
||
export default async function({ readConfigFile }: FtrConfigProviderContext) { | ||
const commonConfig = await readConfigFile(require.resolve('./config')); | ||
|
||
return { | ||
...commonConfig.getAll(), | ||
testFiles: [require.resolve('./public')], | ||
kbnTestServer: { | ||
serverArgs: [ | ||
...commonConfig.get('kbnTestServer.serverArgs'), | ||
`--plugin-path=${path.resolve( | ||
KIBANA_ROOT, | ||
'test/plugin_functional/plugins/core_provider_plugin' | ||
)}`, | ||
], | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../services'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function({ loadTestFile }: FtrProviderContext) { | ||
describe('Legacy licensing plugin', function() { | ||
this.tags('ciGroup2'); | ||
// MUST BE LAST! CHANGES LICENSE TYPE! | ||
loadTestFile(require.resolve('./updates')); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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 { 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 supertest = getService('supertest'); | ||
const testSubjects = getService('testSubjects'); | ||
|
||
const scenario = createScenario(ftrContext); | ||
|
||
describe('changes in license types', () => { | ||
after(async () => { | ||
await scenario.startBasic(); | ||
}); | ||
|
||
it('provides changes in license types', async () => { | ||
await scenario.setup(); | ||
await scenario.waitForPluginToDetectLicenseUpdate(); | ||
|
||
const { | ||
body: legacyInitialLicense, | ||
headers: legacyInitialLicenseHeaders, | ||
} = await supertest.get('/api/xpack/v1/info').expect(200); | ||
|
||
expect(legacyInitialLicense.license?.type).to.be('basic'); | ||
expect(legacyInitialLicense.features).to.have.property('security'); | ||
expect(legacyInitialLicenseHeaders['kbn-xpack-sig']).to.be.a('string'); | ||
|
||
// server allows to request trial only once. | ||
// other attempts will throw 403 | ||
await scenario.startTrial(); | ||
await scenario.waitForPluginToDetectLicenseUpdate(); | ||
|
||
const { body: legacyTrialLicense, headers: legacyTrialLicenseHeaders } = await supertest | ||
.get('/api/xpack/v1/info') | ||
.expect(200); | ||
|
||
expect(legacyTrialLicense.license?.type).to.be('trial'); | ||
expect(legacyTrialLicense.features).to.have.property('security'); | ||
expect(legacyTrialLicenseHeaders['kbn-xpack-sig']).to.not.be( | ||
legacyInitialLicenseHeaders['kbn-xpack-sig'] | ||
); | ||
|
||
await scenario.startBasic(); | ||
await scenario.waitForPluginToDetectLicenseUpdate(); | ||
|
||
const { body: legacyBasicLicense, headers: legacyBasicLicenseHeaders } = await supertest | ||
.get('/api/xpack/v1/info') | ||
.expect(200); | ||
expect(legacyBasicLicense.license?.type).to.be('basic'); | ||
expect(legacyBasicLicense.features).to.have.property('security'); | ||
expect(legacyBasicLicenseHeaders['kbn-xpack-sig']).to.not.be( | ||
legacyInitialLicenseHeaders['kbn-xpack-sig'] | ||
); | ||
|
||
await scenario.deleteLicense(); | ||
await scenario.waitForPluginToDetectLicenseUpdate(); | ||
|
||
// banner shown only when license expired not just deleted | ||
await testSubjects.missingOrFail('licenseExpiredBanner'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../services'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function({ loadTestFile }: FtrProviderContext) { | ||
describe('Licensing plugin public client', function() { | ||
this.tags('ciGroup2'); | ||
// MUST BE LAST! CHANGES LICENSE TYPE! | ||
loadTestFile(require.resolve('./updates')); | ||
}); | ||
} |
Oops, something went wrong.