Skip to content

Commit

Permalink
[Index Management] Fix get data streams api integration (#71067)
Browse files Browse the repository at this point in the history
* fix get all data streams api integration test

* fix and skip api integration with ES for fetching one data stream

* update types

* fix types issue

* unskip tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
jloleysens and elasticmachine authored Jul 9, 2020
1 parent a5bbbf9 commit b25b690
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const setup = async (overridingDependencies: any = {}): Promise<DataStrea

export const createDataStreamPayload = (name: string): DataStream => ({
name,
timeStampField: { name: '@timestamp', mapping: { type: 'date' } },
timeStampField: { name: '@timestamp' },
indices: [
{
name: 'indexName',
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugins/index_management/common/types/data_streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

interface TimestampFieldFromEs {
name: string;
mapping: {
type: string;
};
}

type TimestampField = TimestampFieldFromEs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export function registerGetAllRoute({ router, license, lib: { isEsError } }: Rou
const { callAsCurrentUser } = ctx.dataManagement!.client;

try {
const dataStreams = await callAsCurrentUser('dataManagement.getDataStreams');
const { data_streams: dataStreams } = await callAsCurrentUser(
'dataManagement.getDataStreams'
);
const body = deserializeDataStreamList(dataStreams);

return res.ok({ body });
Expand Down Expand Up @@ -50,7 +52,10 @@ export function registerGetOneRoute({ router, license, lib: { isEsError } }: Rou
const { callAsCurrentUser } = ctx.dataManagement!.client;

try {
const dataStream = await callAsCurrentUser('dataManagement.getDataStream', { name });
const { data_streams: dataStream } = await callAsCurrentUser(
'dataManagement.getDataStream',
{ name }
);

if (dataStream[0]) {
const body = deserializeDataStream(dataStream[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export default function ({ getService }: FtrProviderContext) {
await deleteComposableIndexTemplate(name);
};

// Failing ES Promotion: https://github.com/elastic/kibana/issues/71018
describe.skip('Data streams', function () {
describe('Data streams', function () {
describe('Get', () => {
const testDataStreamName = 'test-data-stream';

Expand All @@ -72,7 +71,7 @@ export default function ({ getService }: FtrProviderContext) {
expect(dataStreams).to.eql([
{
name: testDataStreamName,
timeStampField: { name: '@timestamp', mapping: { type: 'date' } },
timeStampField: { name: '@timestamp' },
indices: [
{
name: indexName,
Expand All @@ -94,7 +93,7 @@ export default function ({ getService }: FtrProviderContext) {
const { name: indexName, uuid } = dataStream.indices[0];
expect(dataStream).to.eql({
name: testDataStreamName,
timeStampField: { name: '@timestamp', mapping: { type: 'date' } },
timeStampField: { name: '@timestamp' },
indices: [
{
name: indexName,
Expand Down

0 comments on commit b25b690

Please sign in to comment.