Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-85770
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 15, 2020
2 parents 221b23b + d3ce8ae commit 9070f71
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 13 deletions.
13 changes: 7 additions & 6 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'common',
]);

// Failing: See https://github.com/elastic/kibana/issues/75127
describe.skip('visual builder', function describeIndexTests() {
describe('visual builder', function describeIndexTests() {
this.tags('includeFirefox');
beforeEach(async () => {
await security.testUser.setRoles([
Expand Down Expand Up @@ -144,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visualBuilder.selectIndexPatternTimeField('timestamp');
});
const newValue = await PageObjects.visualBuilder.getMetricValue();
expect(newValue).to.eql('10');
expect(newValue).to.eql('18');
});
});

Expand Down Expand Up @@ -174,9 +173,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await browser.goBack();

log.debug('Check timeseries chart and panel config is rendered');
await PageObjects.visualBuilder.checkTimeSeriesChartIsPresent();
await PageObjects.visualBuilder.checkTabIsSelected('timeseries');
await PageObjects.visualBuilder.checkPanelConfigIsPresent('timeseries');
await retry.try(async () => {
await PageObjects.visualBuilder.checkTimeSeriesChartIsPresent();
await PageObjects.visualBuilder.checkTabIsSelected('timeseries');
await PageObjects.visualBuilder.checkPanelConfigIsPresent('timeseries');
});

log.debug('Go forward in browser history');
await browser.goForward();
Expand Down
6 changes: 4 additions & 2 deletions test/functional/services/combo_box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
public async openOptionsList(comboBoxElement: WebElementWrapper): Promise<void> {
const isOptionsListOpen = await testSubjects.exists('~comboBoxOptionsList');
if (!isOptionsListOpen) {
const toggleBtn = await comboBoxElement.findByTestSubject('comboBoxToggleListButton');
await toggleBtn.click();
await retry.try(async () => {
const toggleBtn = await comboBoxElement.findByTestSubject('comboBoxInput');
await toggleBtn.click();
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/server/services/api_keys/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function generateOutputApiKey(
cluster: ['monitor'],
index: [
{
names: ['logs-*', 'metrics-*', 'events-*', '.ds-logs-*', '.ds-metrics-*', '.ds-events-*'],
names: ['logs-*', 'metrics-*', 'traces-*', '.ds-logs-*', '.ds-metrics-*', '.ds-traces-*'],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
},
],
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/server/services/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export async function setupFleet(
cluster: ['monitor', 'manage_api_key'],
indices: [
{
names: ['logs-*', 'metrics-*', 'events-*', '.ds-logs-*', '.ds-metrics-*', '.ds-events-*'],
names: ['logs-*', 'metrics-*', 'traces-*', '.ds-logs-*', '.ds-metrics-*', '.ds-traces-*'],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
},
],
Expand Down
19 changes: 19 additions & 0 deletions x-pack/plugins/licensing/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ describe('licensing plugin', () => {
expect(license.isAvailable).toBe(true);
});

it('calls `callAsInternalUser` with the correct parameters', async () => {
const esClient = elasticsearchServiceMock.createLegacyClusterClient();
esClient.callAsInternalUser.mockResolvedValue({
license: buildRawLicense(),
features: {},
});

const coreSetup = createCoreSetupWith(esClient);
await plugin.setup(coreSetup);
const { license$ } = await plugin.start();
await license$.pipe(take(1)).toPromise();

expect(esClient.callAsInternalUser).toHaveBeenCalledTimes(1);
expect(esClient.callAsInternalUser).toHaveBeenCalledWith('transport.request', {
method: 'GET',
path: '/_xpack?accept_enterprise=true',
});
});

it('observable receives updated licenses', async () => {
const types: LicenseType[] = ['basic', 'gold', 'platinum'];

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/licensing/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class LicensingPlugin implements Plugin<LicensingPluginSetup, LicensingPl
try {
const response = await clusterClient.callAsInternalUser('transport.request', {
method: 'GET',
path: '/_xpack',
path: '/_xpack?accept_enterprise=true',
});

const normalizedLicense = response.license
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { IField } from '../../fields/field';
import { ITooltipProperty, TooltipProperty } from '../../tooltips/tooltip_property';
import { esFilters } from '../../../../../../../src/plugins/data/public';
import { getIsGoldPlus } from '../../../licensed_features';
import { LICENSED_FEATURES } from '../../../licensed_features';

const MAX_TRACKS = 250;

Expand Down Expand Up @@ -357,6 +358,10 @@ export class ESGeoLineSource extends AbstractESAggSource {
);
return tooltipProperties;
}

async getLicensedFeatures(): Promise<LICENSED_FEATURES[]> {
return [LICENSED_FEATURES.GEO_LINE_AGG];
}
}

registerSource({
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/maps/public/licensed_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { LicensingPluginSetup, LicensingPluginStart } from '../../licensing/publ
import { APP_ID } from '../common/constants';

export enum LICENSED_FEATURES {
GEO_LINE_AGG = 'GEO_LINE_AGG',
GEO_SHAPE_AGGS_GEO_TILE = 'GEO_SHAPE_AGGS_GEO_TILE',
}

Expand All @@ -18,6 +19,10 @@ export interface LicensedFeatureDetail {
}

export const LICENCED_FEATURES_DETAILS: Record<LICENSED_FEATURES, LicensedFeatureDetail> = {
[LICENSED_FEATURES.GEO_LINE_AGG]: {
name: 'geo_line aggregation',
license: 'gold',
},
[LICENSED_FEATURES.GEO_SHAPE_AGGS_GEO_TILE]: {
name: 'geo_tile aggregation on geo_shape field-type',
license: 'gold',
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/fleet_api_integration/apis/agents_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export default function (providerContext: FtrProviderContext) {
names: [
'logs-*',
'metrics-*',
'events-*',
'traces-*',
'.ds-logs-*',
'.ds-metrics-*',
'.ds-events-*',
'.ds-traces-*',
],
privileges: ['write', 'create_index', 'indices:admin/auto_create'],
allow_restricted_indices: false,
Expand Down
25 changes: 25 additions & 0 deletions x-pack/test/licensing_plugin/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ export function createScenario({ getService, getPageObjects }: FtrProviderContex
expect(response.body.trial_was_started).to.be(true);
},

async startEnterprise() {
const response = await esSupertestWithoutAuth
.post('/_license/?acknowledge=true')
.send({
license: {
uid: '00000000-d3ad-7357-c0d3-000000000000',
type: 'enterprise',
issue_date_in_millis: 1577836800000,
start_date_in_millis: 1577836800000,
// expires 2022-12-31
expiry_date_in_millis: 1672531199999,
max_resource_units: 250,
max_nodes: null,
issued_to: 'Elastic Internal Use (development environments)',
issuer: 'Elastic',
signature:
'AAAABQAAAA1gHUVis7hel8b8nNCAAAAAIAo5/x6hrsGh1GqqrJmy4qgmEC7gK0U4zQ6q5ZEMhm4jAAABAKMR+w3KZsMJfG5jNWgZXJLwRmiNqN7k94vKFgRdj1yM+gA9ufhXIn9d01OvFhPjilIqm+fxVjCxXwGKbFRiwtTWnTYjXPuNml+qCFGgUWguWEcVoIW6VU7/lYOqMJ4EB4zOMLe93P267iaDm542aelQrW1OJ69lGGuPBik8v9r1bNZzKBQ99VUr/qoosGDAm0udh2HxWzYoCL5lDML5Niy87xlVCubSSBXdUXzUgdZKKk6pKaMdHswB1gjvEfnwqPxEWAyrV0BCr/T1WehXd7U4p6/zt6sJ6cPh+34AZe9g4+3WPKrZhX4iaSHMDDHn4HNjO72CZ2oi42ZDNnJ37tA=',
},
})
.auth('license_manager_user', 'license_manager_user-password')
.expect(200);

expect(response.body.license_status).to.be('valid');
},

async deleteLicense() {
const response = await esSupertestWithoutAuth
.delete('/_license')
Expand Down
8 changes: 8 additions & 0 deletions x-pack/test/licensing_plugin/server/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,13 @@ export default function (ftrContext: FtrProviderContext) {
// banner shown only when license expired not just deleted
await testSubjects.missingOrFail('licenseExpiredBanner');
});

it('properly recognize an enterprise license', async () => {
await scenario.startEnterprise();
await scenario.waitForPluginToDetectLicenseUpdate();

const enterpriseLicense = await scenario.getLicense();
expect(enterpriseLicense.license?.type).to.be('enterprise');
});
});
}

0 comments on commit 9070f71

Please sign in to comment.