Skip to content

Commit

Permalink
Fix tests that fail due to different sort() behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
gsoldevila committed Apr 13, 2023
1 parent 4fda698 commit 1b3053a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const ALLOWED_CONVERT_VERSION = '8.0.0';
export const DEFAULT_INDEX_TYPES_MAP: IndexTypesMap = {
'.kibana_task_manager': ['task'],
'.kibana': [
'action_task_params',
'action',
'action_task_params',
'alert',
'api_key_pending_invalidation',
'apm-indices',
Expand All @@ -41,30 +41,30 @@ export const DEFAULT_INDEX_TYPES_MAP: IndexTypesMap = {
'application_usage_totals',
'book',
'canvas-element',
'canvas-workpad-template',
'canvas-workpad',
'canvas-workpad-template',
'cases',
'cases-comments',
'cases-configure',
'cases-connector-mappings',
'cases-telemetry',
'cases-user-actions',
'cases',
'config-global',
'config',
'config-global',
'connector_token',
'core-usage-stats',
'csp-rule-template',
'dashboard',
'endpoint:user-artifact-manifest',
'endpoint:user-artifact',
'endpoint:user-artifact-manifest',
'enterprise_search_telemetry',
'epm-packages-assets',
'epm-packages',
'epm-packages-assets',
'event_loop_delays_daily',
'exception-list-agnostic',
'exception-list',
'file-upload-usage-collection-telemetry',
'exception-list-agnostic',
'file',
'file-upload-usage-collection-telemetry',
'fileShare',
'fleet-fleet-server-host',
'fleet-message-signing-keys',
Expand All @@ -76,39 +76,39 @@ export const DEFAULT_INDEX_TYPES_MAP: IndexTypesMap = {
'index-pattern',
'infrastructure-monitoring-log-view',
'infrastructure-ui-source',
'ingest_manager_settings',
'ingest-agent-policies',
'ingest-download-sources',
'ingest-outputs',
'ingest-package-policies',
'ingest_manager_settings',
'inventory-view',
'kql-telemetry',
'legacy-url-alias',
'lens-ui-telemetry',
'lens',
'lens-ui-telemetry',
'map',
'metrics-explorer-view',
'ml-job',
'ml-module',
'ml-trained-model',
'monitoring-telemetry',
'osquery-manager-usage-metric',
'osquery-pack-asset',
'osquery-pack',
'osquery-pack-asset',
'osquery-saved-query',
'query',
'rules-settings',
'sample-data-telemetry',
'search',
'search-session',
'search-telemetry',
'search',
'searchableList',
'security-rule',
'security-solution-signals-migration',
'siem-detection-engine-rule-actions',
'siem-ui-timeline',
'siem-ui-timeline-note',
'siem-ui-timeline-pinned-event',
'siem-ui-timeline',
'slo',
'space',
'spaces-usage-stats',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

import Path from 'path';
import type { TestElasticsearchUtils } from '@kbn/core-test-helpers-kbn-server';
import type { ISavedObjectTypeRegistry, SavedObjectsType } from '@kbn/core-saved-objects-server';
import {
type ISavedObjectTypeRegistry,
type SavedObjectsType,
MAIN_SAVED_OBJECT_INDEX,
} from '@kbn/core-saved-objects-server';
import {
readLog,
startElasticsearch,
Expand All @@ -28,6 +32,9 @@ const RELOCATE_TYPES: Record<string, string> = {
visualization: '.kibana_so_ui',
'canvas-workpad': '.kibana_so_ui',
search: '.kibana_so_search',
task: '.kibana_task_manager',
// the remaining types will be forced to go to '.kibana',
// overriding `indexPattern: foo` defined in the registry
};

describe('split .kibana index into multiple system indices', () => {
Expand All @@ -54,7 +61,7 @@ describe('split .kibana index into multiple system indices', () => {
(type: SavedObjectsType<any>) => {
return {
...type,
indexPattern: RELOCATE_TYPES[type.name] ?? type.indexPattern,
indexPattern: RELOCATE_TYPES[type.name] ?? MAIN_SAVED_OBJECT_INDEX,
};
}
);
Expand Down Expand Up @@ -157,8 +164,8 @@ describe('split .kibana index into multiple system indices', () => {
.toMatchInlineSnapshot(`
Object {
".kibana": Array [
"action_task_params",
"action",
"action_task_params",
"alert",
"api_key_pending_invalidation",
"apm-indices",
Expand All @@ -170,27 +177,27 @@ describe('split .kibana index into multiple system indices', () => {
"application_usage_totals",
"canvas-element",
"canvas-workpad-template",
"cases",
"cases-comments",
"cases-configure",
"cases-connector-mappings",
"cases-telemetry",
"cases-user-actions",
"cases",
"config-global",
"config",
"config-global",
"connector_token",
"core-usage-stats",
"csp-rule-template",
"endpoint:user-artifact-manifest",
"endpoint:user-artifact",
"endpoint:user-artifact-manifest",
"enterprise_search_telemetry",
"epm-packages-assets",
"epm-packages",
"epm-packages-assets",
"event_loop_delays_daily",
"exception-list-agnostic",
"exception-list",
"file-upload-usage-collection-telemetry",
"exception-list-agnostic",
"file",
"file-upload-usage-collection-telemetry",
"fileShare",
"fleet-fleet-server-host",
"fleet-message-signing-keys",
Expand All @@ -202,25 +209,25 @@ describe('split .kibana index into multiple system indices', () => {
"index-pattern",
"infrastructure-monitoring-log-view",
"infrastructure-ui-source",
"ingest_manager_settings",
"ingest-agent-policies",
"ingest-download-sources",
"ingest-outputs",
"ingest-package-policies",
"ingest_manager_settings",
"inventory-view",
"kql-telemetry",
"legacy-url-alias",
"lens-ui-telemetry",
"lens",
"lens-ui-telemetry",
"map",
"metrics-explorer-view",
"ml-job",
"ml-module",
"ml-trained-model",
"monitoring-telemetry",
"osquery-manager-usage-metric",
"osquery-pack-asset",
"osquery-pack",
"osquery-pack-asset",
"osquery-saved-query",
"query",
"rules-settings",
Expand All @@ -230,9 +237,9 @@ describe('split .kibana index into multiple system indices', () => {
"security-rule",
"security-solution-signals-migration",
"siem-detection-engine-rule-actions",
"siem-ui-timeline",
"siem-ui-timeline-note",
"siem-ui-timeline-pinned-event",
"siem-ui-timeline",
"slo",
"space",
"spaces-usage-stats",
Expand All @@ -254,9 +261,9 @@ describe('split .kibana index into multiple system indices', () => {
"search",
],
".kibana_so_ui": Array [
"visualization",
"canvas-workpad",
"dashboard",
"visualization",
],
".kibana_task_manager": Array [
"task",
Expand Down

0 comments on commit 1b3053a

Please sign in to comment.