From 0a0f03da43a275325d99a3027853370ddae0b161 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:08:18 +0800 Subject: [PATCH] Add functional test for version decouple (#1412) (#1413) Signed-off-by: Yuanqi(Ella) Zhu (cherry picked from commit fe27b0231915213759a0b4cb0bb5fc5b4a3b7ebc) Co-authored-by: Yuanqi(Ella) Zhu <53279298+zhyuanqi@users.noreply.github.com> --- .../5_version_decouple.spec.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/5_version_decouple.spec.js diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/5_version_decouple.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/5_version_decouple.spec.js new file mode 100644 index 000000000..d78c5dc6d --- /dev/null +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/5_version_decouple.spec.js @@ -0,0 +1,44 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { + describe('Create datasources', () => { + before(() => { + // Clean up before creating new data sources for testing + cy.deleteAllDataSources(); + cy.createDataSourceNoAuthWithTitle('ds_1'); + cy.wait(6000); + }); + + after(() => { + // Clean up after all test are run + cy.deleteAllDataSources(); + // remove the default data source + cy.setAdvancedSetting({ + defaultDataSource: '', + }); + }); + + describe('Check datasource contains version decouple related information', () => { + it('check installed plugins and data source version information is showed', () => { + cy.request({ + method: 'GET', + url: '/api/saved_objects/_find?type=data-source', + }).then((response) => { + const savedObjects = response.body.saved_objects; + expect( + savedObjects, + 'Data sources should exist' + ).to.have.length.greaterThan(0); + + const dataSource = savedObjects[0]; + const { attributes } = dataSource; + expect(attributes).to.have.property('dataSourceVersion'); + expect(attributes).to.have.property('installedPlugins'); + }); + }); + }); + }); +}