forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Enterprise license for service map (elastic#62371)
We were previously only allowing "platinum" and "trial". Change this to allow `hasAtLeast('platinum')` which includes "platinum", "enterprise", and "trial". Fixes elastic#62243.
- Loading branch information
1 parent
efc68c2
commit ce42404
Showing
2 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
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,97 @@ | ||
/* | ||
* 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 { License } from '../../licensing/common/license'; | ||
import * as serviceMap from './service_map'; | ||
|
||
describe('service map helpers', () => { | ||
describe('isValidPlatinumLicense', () => { | ||
describe('with an expired license', () => { | ||
it('returns false', () => { | ||
const license = new License({ | ||
license: { | ||
uid: 'test uid', | ||
expiryDateInMillis: 0, | ||
mode: 'platinum', | ||
type: 'platinum', | ||
status: 'expired' | ||
}, | ||
signature: 'test signature' | ||
}); | ||
|
||
expect(serviceMap.isValidPlatinumLicense(license)).toEqual(false); | ||
}); | ||
}); | ||
|
||
describe('with a basic license', () => { | ||
it('returns false', () => { | ||
const license = new License({ | ||
license: { | ||
uid: 'test uid', | ||
expiryDateInMillis: 0, | ||
mode: 'basic', | ||
type: 'basic', | ||
status: 'active' | ||
}, | ||
signature: 'test signature' | ||
}); | ||
|
||
expect(serviceMap.isValidPlatinumLicense(license)).toEqual(false); | ||
}); | ||
}); | ||
|
||
describe('with a platinum license', () => { | ||
it('returns true', () => { | ||
const license = new License({ | ||
license: { | ||
uid: 'test uid', | ||
expiryDateInMillis: 0, | ||
mode: 'platinum', | ||
type: 'platinum', | ||
status: 'active' | ||
}, | ||
signature: 'test signature' | ||
}); | ||
|
||
expect(serviceMap.isValidPlatinumLicense(license)).toEqual(true); | ||
}); | ||
}); | ||
|
||
describe('with an enterprise license', () => { | ||
it('returns true', () => { | ||
const license = new License({ | ||
license: { | ||
uid: 'test uid', | ||
expiryDateInMillis: 0, | ||
mode: 'enterprise', | ||
type: 'enterprise', | ||
status: 'active' | ||
}, | ||
signature: 'test signature' | ||
}); | ||
|
||
expect(serviceMap.isValidPlatinumLicense(license)).toEqual(true); | ||
}); | ||
}); | ||
|
||
describe('with a trial license', () => { | ||
it('returns true', () => { | ||
const license = new License({ | ||
license: { | ||
uid: 'test uid', | ||
expiryDateInMillis: 0, | ||
mode: 'trial', | ||
type: 'trial', | ||
status: 'active' | ||
}, | ||
signature: 'test signature' | ||
}); | ||
|
||
expect(serviceMap.isValidPlatinumLicense(license)).toEqual(true); | ||
}); | ||
}); | ||
}); | ||
}); |
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