From 7789295328d4c2b4353f00ccf39cae204cee9f4e Mon Sep 17 00:00:00 2001 From: Manasvini B Suryanarayana Date: Thu, 29 Dec 2022 13:39:48 -0800 Subject: [PATCH 1/2] Adds config override to fix obsolete theme:version config value of v8 (beta) rendering issue (#3045) Signed-off-by: Manasvini B Suryanarayana --- CHANGELOG.md | 2 ++ .../ui_settings/ui_settings_client.test.ts | 23 +++++++++++++++++++ .../server/ui_settings/ui_settings_config.ts | 7 +++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4fd806d9e5..d0d7328b3bee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Table Visualization][BUG] Fix Url content display issue in table ([#2918](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2918)) - Fixes misleading embaddable plugin error message ([#3043](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3043)) - [MD] Update dummy url in tests to follow lychee url allowlist ([#3099](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3099)) +- Adds config override to fix obsolete theme:version config value of v8 (beta) rendering issue ([#3045](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3045)) + ### 🚞 Infrastructure diff --git a/src/core/server/ui_settings/ui_settings_client.test.ts b/src/core/server/ui_settings/ui_settings_client.test.ts index 72461653d652..a7aa95ebab91 100644 --- a/src/core/server/ui_settings/ui_settings_client.test.ts +++ b/src/core/server/ui_settings/ui_settings_client.test.ts @@ -624,6 +624,29 @@ describe('ui settings', () => { expect(await uiSettings.get('dateFormat')).toBe('foo'); }); + it('returns the overridden value for key theme:version', async () => { + const opensearchDocSource = { 'theme:version': 'v8 (beta)' }; + const overrides = { 'theme:version': 'v7' }; + const { uiSettings } = setup({ opensearchDocSource, overrides }); + + expect(await uiSettings.get('theme:version')).toBe('v7'); + }); + + it('returns the overridden value for key theme:version when doc source is empty', async () => { + const opensearchDocSource = {}; + const overrides = { 'theme:version': 'v7' }; + const { uiSettings } = setup({ opensearchDocSource, overrides }); + + expect(await uiSettings.get('theme:version')).toBe('v7'); + }); + + it('rewrites the key theme:version value without override', async () => { + const opensearchDocSource = { 'theme:version': 'v8 (beta)' }; + const { uiSettings } = setup({ opensearchDocSource }); + + expect(await uiSettings.get('theme:version')).toBe('v8 (beta)'); + }); + it('returns the default value for an override with value null', async () => { const opensearchDocSource = { dateFormat: 'YYYY-MM-DD' }; const overrides = { dateFormat: null }; diff --git a/src/core/server/ui_settings/ui_settings_config.ts b/src/core/server/ui_settings/ui_settings_config.ts index 4c3dd0e4dcf5..634fb5c62d55 100644 --- a/src/core/server/ui_settings/ui_settings_config.ts +++ b/src/core/server/ui_settings/ui_settings_config.ts @@ -38,7 +38,12 @@ const deprecations: ConfigDeprecationProvider = ({ unused, renameFromRoot }) => ]; const configSchema = schema.object({ - overrides: schema.object({}, { unknowns: 'allow' }), + overrides: schema.object( + { + 'theme:version': schema.string({ defaultValue: 'v7' }), + }, + { unknowns: 'allow' } + ), }); export type UiSettingsConfigType = TypeOf; From e9485f6ad5031a5a54c2fd1cba1e2cadc2bdef2c Mon Sep 17 00:00:00 2001 From: Miki Date: Thu, 29 Dec 2022 13:41:40 -0800 Subject: [PATCH 2/2] Adds retrying flaky jest tests (#2967) Signed-off-by: Miki Co-authored-by: Anan Zhuang Co-authored-by: Josh Romero Co-authored-by: Qingyang(Abby) Hu --- CHANGELOG.md | 1 + package.json | 4 +++- src/dev/jest/config.js | 1 + yarn.lock | 12 ++++++------ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0d7328b3bee..65aab4f74521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,6 +119,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multi DataSource] Add unit test coverage for Update Data source management stack ([#2567](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2567)) - [BWC Tests] Add BWC tests for 2.5.0 ([#2890](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2890)) +- Add retrial of flaky tests ([#2967](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2967)) - Fix incorrect validation of time values in JUnit Reporter ([#2965](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2965)) - Make tests covering plugin installation on cluster snapshots work across platforms ([#2994](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2994)) - Correct the linting logic for `no-restricted-path` to ignore trailing slashes ([#3020](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3020)) diff --git a/package.json b/package.json index d363e7bb0d66..cc7f3c2bf288 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,9 @@ "**/qs": "^6.10.3", "**/trim": "^0.0.3", "**/typescript": "4.0.2", - "**/unset-value": "^2.0.1" + "**/unset-value": "^2.0.1", + "**/jest-config": "npm:@amoo-miki/jest-config@27.5.1", + "**/jest-jasmine2": "npm:@amoo-miki/jest-jasmine2@27.5.1" }, "workspaces": { "packages": [ diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 6eb7b4013354..8dd5240f69de 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -109,4 +109,5 @@ export default { globals: { Uint8Array: Uint8Array, }, + flakyTestRetries: 2, }; diff --git a/yarn.lock b/yarn.lock index 91ed149471ad..dc069a845629 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10821,10 +10821,10 @@ jest-cli@^27.5.1: prompts "^2.0.1" yargs "^16.2.0" -jest-config@^27.5.1: +jest-config@^27.5.1, "jest-config@npm:@amoo-miki/jest-config@27.5.1": version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.5.1.tgz#5c387de33dca3f99ad6357ddeccd91bf3a0e4a41" - integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== + resolved "https://registry.yarnpkg.com/@amoo-miki/jest-config/-/jest-config-27.5.1.tgz#3afdb485fdccad8fd8b19be505747cafbf8e6707" + integrity sha512-6pSD/Lo5axflM2NO0eIHuJ40nxfXn2NQGqzOCrZO1EE7yS3k90p10RalInf8RXl2g9/f1Ax4U4aU2e3BWSaSaQ== dependencies: "@babel/core" "^7.8.0" "@jest/test-sequencer" "^27.5.1" @@ -10929,10 +10929,10 @@ jest-haste-map@^27.5.1: optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.5.1: +jest-jasmine2@^27.5.1, "jest-jasmine2@npm:@amoo-miki/jest-jasmine2@27.5.1": version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" - integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== + resolved "https://registry.yarnpkg.com/@amoo-miki/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#0c99502f9879e1504b124da8355880924de1f310" + integrity sha512-oOihnJGLdFZO780Ts6XR+Sbs8d4J0+sqcNvBNcJch/LSKpQt7rARi0V+TgF80LRAvJI4gyq97az/2fdXXgxDNg== dependencies: "@jest/environment" "^27.5.1" "@jest/source-map" "^27.5.1"