Skip to content

Commit

Permalink
Merge branch 'main' into fields_for_wildcard_stale_while_revalidate
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime authored Jan 14, 2024
2 parents 194527e + 8cc7cad commit b12b865
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ describe('<TemplateCreate />', () => {
await actions.completeStepOne({
name: TEMPLATE_NAME,
indexPatterns: DEFAULT_INDEX_PATTERNS,
dataStream: {},
allowAutoCreate: true,
});
// Component templates
Expand Down Expand Up @@ -618,7 +617,6 @@ describe('<TemplateCreate />', () => {
await testBed.actions.completeStepOne({
name: TEMPLATE_NAME,
indexPatterns: DEFAULT_INDEX_PATTERNS,
dataStream: {},
lifecycle: {
enabled: true,
value: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ export const formSetup = async (initTestBed: SetupFunc<TestSubjects>) => {
order,
priority,
version,
dataStream,
enableDataStream,
lifecycle,
allowAutoCreate,
}: Partial<TemplateDeserialized> = {}) => {
}: Partial<TemplateDeserialized> & { enableDataStream?: boolean } = {}) => {
const { component, form, find } = testBed;

if (name) {
Expand All @@ -174,7 +174,12 @@ export const formSetup = async (initTestBed: SetupFunc<TestSubjects>) => {
form.setInputValue('orderField.input', JSON.stringify(order));
}

if (dataStream) {
// Deal with toggling the data stream switch
const isDataStreamEnabled = find('dataStreamField.input').props().checked;

if (enableDataStream && !isDataStreamEnabled) {
form.toggleEuiSwitch('dataStreamField.input');
} else if (!enableDataStream && isDataStreamEnabled) {
form.toggleEuiSwitch('dataStreamField.input');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export const TemplateForm = ({
const indexTemplate = defaultValue ?? {
name: '',
indexPatterns: [],
dataStream: {},
template: {},
_kbnMeta: {
type: 'default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// Complete required fields from step 1
await testSubjects.setValue('nameField', INDEX_TEMPLATE_NAME);
await testSubjects.setValue('indexPatternsField', 'test-1');
// Enable data stream
await testSubjects.click('dataStreamField > input');
// Enable data retention
await testSubjects.click('dataRetentionToggle > input');
// Set the retention to 7 hours
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const testSubjects = getService('testSubjects');
const es = getService('es');
const retry = getService('retry');
const log = getService('log');

const TEST_TEMPLATE = 'a_test_template';
const INDEX_PATTERN = `index_pattern_${Math.random()}`;

describe('Index Templates', function () {
before(async () => {
Expand All @@ -32,6 +34,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});

after(async () => {
log.debug('Cleaning up created template');

try {
await es.indices.deleteIndexTemplate({ name: TEST_TEMPLATE }, { ignore: [404] });
} catch (e) {
log.debug('[Setup error] Error creating test policy');
throw e;
}

await pageObjects.svlCommonPage.forceLogout();
});

Expand All @@ -45,7 +56,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await es.indices.putIndexTemplate({
name: TEST_TEMPLATE,
body: {
index_patterns: ['test*'],
index_patterns: [INDEX_PATTERN],
},
});
});
Expand Down Expand Up @@ -85,7 +96,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await testSubjects.click('createTemplateButton');

await testSubjects.setValue('nameField', TEST_TEMPLATE_NAME);
await testSubjects.setValue('indexPatternsField', 'test*');
await testSubjects.setValue('indexPatternsField', INDEX_PATTERN);

// Click form summary step and then the submit button
await testSubjects.click('formWizardStep-5');
Expand Down

0 comments on commit b12b865

Please sign in to comment.