mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Serverless Snapshot Telemetry] Fallback ES version (#159600)
This commit is contained in:
parent
64ab4fda32
commit
d240154af1
2 changed files with 16 additions and 3 deletions
|
@ -192,12 +192,25 @@ describe('get_local_stats', () => {
|
|||
expect(result.cluster_uuid).toStrictEqual(combinedStatsResult.cluster_uuid);
|
||||
expect(result.cluster_name).toStrictEqual(combinedStatsResult.cluster_name);
|
||||
expect(result.cluster_stats).toStrictEqual(combinedStatsResult.cluster_stats);
|
||||
expect(result.version).toEqual('2.3.4');
|
||||
expect(result.version).toEqual(version);
|
||||
expect(result.collection).toEqual('local');
|
||||
expect(Object.keys(result)).not.toContain('license');
|
||||
expect(result.stack_stats).toEqual({ kibana: undefined, data: undefined });
|
||||
});
|
||||
|
||||
it('fallbacks to Kibana version if ES does not respond with it', () => {
|
||||
const { version: _, ...clusterInfoWithoutVersion } = clusterInfo;
|
||||
const result = handleLocalStats(
|
||||
clusterInfoWithoutVersion as estypes.InfoResponse,
|
||||
clusterStatsWithNodesUsage,
|
||||
void 0,
|
||||
void 0,
|
||||
context
|
||||
);
|
||||
|
||||
expect(result.version).toEqual(context.version);
|
||||
});
|
||||
|
||||
it('returns expected object with xpack', () => {
|
||||
const result = handleLocalStats(
|
||||
clusterInfo as estypes.InfoResponse,
|
||||
|
@ -234,7 +247,7 @@ describe('get_local_stats', () => {
|
|||
expect(result.cluster_name).toEqual(combinedStatsResult.cluster_name);
|
||||
expect(result.cluster_stats).toEqual(combinedStatsResult.cluster_stats);
|
||||
expect(result.cluster_stats.nodes).toEqual(combinedStatsResult.cluster_stats.nodes);
|
||||
expect(result.version).toBe('2.3.4');
|
||||
expect(result.version).toBe(version);
|
||||
expect(result.collection).toBe('local');
|
||||
expect(Object.keys(result).indexOf('license')).toBeLessThan(0);
|
||||
expect(Object.keys(result.stack_stats).indexOf('xpack')).toBeLessThan(0);
|
||||
|
|
|
@ -38,7 +38,7 @@ export function handleLocalStats<ClusterStats extends estypes.ClusterStatsRespon
|
|||
timestamp: new Date().toISOString(),
|
||||
cluster_uuid,
|
||||
cluster_name,
|
||||
version: version.number,
|
||||
version: version?.number || context.version,
|
||||
cluster_stats: clusterStats,
|
||||
collection: 'local',
|
||||
stack_stats: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue