[Uptime] Un-skip rest api test (#137676) (#137968)

(cherry picked from commit 40ce451d72)

Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-03 09:08:13 -04:00 committed by GitHub
parent aa34e2e41f
commit 46166da467
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 10 deletions

View file

@ -29,7 +29,6 @@ export const SummaryType = t.partial({
export const StatesIndexStatusType = t.type({
indexExists: t.boolean,
docCount: t.number,
indices: t.string,
});

View file

@ -20,11 +20,10 @@ describe('fetch saga effect factory', () => {
it('works with success workflow', () => {
const indexStatusResult = {
indexExists: true,
docCount: 2712532,
indices: 'heartbeat-*,synthetics-*',
};
const fetchStatus = async (): Promise<StatesIndexStatus> => {
return { indexExists: true, docCount: 2712532, indices: 'heartbeat-*,synthetics-*' };
return { indexExists: true, indices: 'heartbeat-*,synthetics-*' };
};
fetchEffect = fetchEffectFactory(
fetchStatus,

View file

@ -118,7 +118,7 @@ export class UptimePlugin
hasData: async () => {
const dataHelper = await getUptimeDataHelper();
const status = await dataHelper.indexStatus();
return { hasData: status.docCount > 0, indices: status.indices };
return { hasData: status.indexExists, indices: status.indices };
},
fetchData: async (params: FetchDataParams) => {
const dataHelper = await getUptimeDataHelper();

View file

@ -17,14 +17,12 @@ export const getIndexStatus: UMElasticsearchQueryFn<{}, StatesIndexStatus> = asy
result: {
body: {
_shards: { total },
count,
},
},
} = await uptimeEsClient.count({ terminate_after: 1 });
return {
indices,
indexExists: total > 0,
docCount: count,
};
} catch (e) {
if (e.meta.statusCode === 404) {
@ -32,7 +30,6 @@ export const getIndexStatus: UMElasticsearchQueryFn<{}, StatesIndexStatus> = asy
return {
indices: '',
indexExists: false,
docCount: 0,
};
}
throw e;

View file

@ -1,5 +1,4 @@
{
"indexExists": true,
"docCount": 1,
"indices": "heartbeat-8*,heartbeat-7*,synthetics-*"
}

View file

@ -10,8 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
import { expectFixtureEql } from './helper/expect_fixture_eql';
export default function ({ getService }: FtrProviderContext) {
// Failing ES Promotion: https://github.com/elastic/kibana/issues/136412
describe.skip('docCount query', () => {
describe('indexStatus query', () => {
const supertest = getService('supertest');
it(`will fetch the index's count`, async () => {