Skip to content

Commit

Permalink
fix nanos test
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Oct 28, 2021
1 parent c0d7009 commit 0133637
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
25 changes: 25 additions & 0 deletions x-pack/test/functional/es_archives/reporting/nanos/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"type": "doc",
"value": {
"id": "1",
"index": "nanos",
"source": {
"date": "2015-01-01T12:10:30",
"message": "Hello 1"
},
"type": "_doc"
}
}

{
"type": "doc",
"value": {
"id": "2",
"index": "nanos",
"source": {
"date": "2015-01-01T12:10:30.123456789Z",
"message": "Hello 2"
},
"type": "_doc"
}
}
24 changes: 24 additions & 0 deletions x-pack/test/functional/es_archives/reporting/nanos/mappings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "index",
"value": {
"aliases": {
},
"index": "nanos",
"mappings": {
"properties": {
"date": {
"type": "date_nanos"
},
"message": {
"type": "keyword"
}
}
},
"settings": {
"index": {
"number_of_replicas": "1",
"number_of_shards": "1"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ export default function ({ getService }: FtrProviderContext) {
});

it('Formatted date_nanos data, UTC timezone', async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/nanos');

const res = await generateAPI.getCSVFromSearchSource(
getMockJobParams({
searchSource: {
Expand All @@ -294,9 +296,13 @@ export default function ({ getService }: FtrProviderContext) {
expect(resStatus).to.eql(200);
expect(resType).to.eql('text/csv');
expectSnapshot(resText).toMatch();

await esArchiver.unload('x-pack/test/functional/es_archives/reporting/nanos');
});

it('Formatted date_nanos data, custom timezone (New York)', async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/nanos');

const res = await generateAPI.getCSVFromSearchSource(
getMockJobParams({
browserTimezone: 'America/New_York',
Expand All @@ -315,11 +321,15 @@ export default function ({ getService }: FtrProviderContext) {
expect(resStatus).to.eql(200);
expect(resType).to.eql('text/csv');
expectSnapshot(resText).toMatch();

await esArchiver.unload('x-pack/test/functional/es_archives/reporting/nanos');
});
});

describe('non-timebased', () => {
it('Handle _id and _index columns', async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/nanos');

const res = await generateAPI.getCSVFromSearchSource(
getMockJobParams({
searchSource: {
Expand All @@ -337,6 +347,8 @@ export default function ({ getService }: FtrProviderContext) {
expect(resStatus).to.eql(200);
expect(resType).to.eql('text/csv');
expectSnapshot(resText).toMatch();

await esArchiver.unload('x-pack/test/functional/es_archives/reporting/nanos');
});

it('With filters and non-timebased data', async () => {
Expand Down

0 comments on commit 0133637

Please sign in to comment.