Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main #1356

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .cypress/integration/datasources_test/datasources.spec.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { FONTEND_BASE_PATH, DATASOURCES_API_PREFIX, DATASOURCES_PATH } from '../../utils/constants';

const MANAGE_DATASOURCES_TAG = 'button[data-test-subj="manage"]';
const NEW_DATASOURCES_TAG = 'button[data-test-subj="new"]';
const CREATE_S3_BUTTON = '[data-test-subj="datasource_card_s3glue"]';
const CREATE_PROMETHEUS_BUTTON = '[data-test-subj="datasource_card_prometheus"]';

const visitDatasourcesHomePage = () => {
cy.visit(FONTEND_BASE_PATH + DATASOURCES_API_PREFIX);
};

const visitDatasourcesCreationPage = () => {
cy.visit(FONTEND_BASE_PATH + DATASOURCES_PATH.DATASOURCES_CREATION_BASE);
};

describe('Integration tests for datasources plugin', () => {
it('Navigates to datasources plugin and expects the correct header', () => {
visitDatasourcesHomePage();
cy.get('[data-test-subj="dataconnections-header"]').should('exist');
});

it('Tests navigation between tabs', () => {
visitDatasourcesHomePage();

cy.get(MANAGE_DATASOURCES_TAG)
.should('have.class', 'euiTab-isSelected')
.and('have.attr', 'aria-selected', 'true');
cy.get(MANAGE_DATASOURCES_TAG).click();
cy.url().should('include', '/manage');

cy.get(NEW_DATASOURCES_TAG).click();
cy.get(NEW_DATASOURCES_TAG)
.should('have.class', 'euiTab-isSelected')
.and('have.attr', 'aria-selected', 'true');
cy.url().should('include', '/new');

cy.get(CREATE_S3_BUTTON).should('be.visible');
cy.get(CREATE_PROMETHEUS_BUTTON).should('be.visible');
});

it('Tests navigation of S3 datasources creation page with hash', () => {
visitDatasourcesCreationPage();

cy.get(CREATE_S3_BUTTON).should('be.visible').click();
cy.url().should('include', DATASOURCES_PATH.DATASOURCES_CONFIG_BASE + '/AmazonS3AWSGlue');

cy.get('h1.euiTitle.euiTitle--medium')
.should('be.visible')
.and('contain', 'Configure Amazon S3 data source');
});

it('Tests navigation of Prometheus datasources creation page with hash', () => {
visitDatasourcesCreationPage();

cy.get(CREATE_PROMETHEUS_BUTTON).should('be.visible').click();
cy.url().should('include', DATASOURCES_PATH.DATASOURCES_CONFIG_BASE + '/Prometheus');

cy.get('h4.euiTitle.euiTitle--medium')
.should('be.visible')
.and('contain', 'Configure Prometheus data source');
});
});
11 changes: 11 additions & 0 deletions .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
export const delay = 1500;
export const COMMAND_TIMEOUT_LONG = 10000;

//BASE Constants
export const BACKEND_BASE_PATH = Cypress.env('opensearch');
export const FONTEND_BASE_PATH = Cypress.env('opensearchDashboards');

//Datasources API Constants
export const DATASOURCES_API_PREFIX = '/app/datasources';
export const DATASOURCES_PATH = {
DATASOURCES_CREATION_BASE: `${DATASOURCES_API_PREFIX}#/new`,
DATASOURCES_CONFIG_BASE: `${DATASOURCES_API_PREFIX}#/configure`
};

// trace analytics
export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d';
export const SPAN_ID = 'a673bc074b438374';
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ jobs:
node-version: ${{ steps.versions_step.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'

- name: Configure OpenSearch Dashboards
run: |
rm -rf ./config/opensearch_dashboards.yml
cat << 'EOT' > ./config/opensearch_dashboards.yml
server.host: "0.0.0.0"
home.disableWelcomeScreen: true
EOT
working-directory: OpenSearch-Dashboards

- name: Install correct yarn version for OpenSearch Dashboards
run: |
npm uninstall -g yarn
Expand Down
33 changes: 20 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,32 @@ jobs:
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
run: yarn osd bootstrap

- name: Get list of changed files
id: files
- name: Get list of changed files using GitHub Action
uses: lots0logs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check Changes of Files
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
git fetch origin $BASE_SHA
git diff --name-only $BASE_SHA...$HEAD_SHA > changed_files.txt
CHANGED_FILES=$(cat changed_files.txt | grep -E '\.(js|ts|tsx)$' || true)
echo "::set-output name=changed::${CHANGED_FILES}"
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
echo "FILES_MODIFIED=$(cat ${HOME}/files_modified.json)"
echo "FILES_ADDED=$(cat ${HOME}/files_added.json)"
echo "FILES_RENAMED=$(cat ${HOME}/files_renamed.json)"
echo "FILES_DELETED=$(cat ${HOME}/files_deleted.json)"

- name: Lint Changed Files
run: |
CHANGED_FILES="${{ steps.files.outputs.changed }}"
jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | sort | uniq > /tmp/changed_files.txt
CHANGED_FILES=$(cat /tmp/changed_files.txt)
echo "These are the changed files: $CHANGED_FILES"
if [[ -n "$CHANGED_FILES" ]]; then
echo "Linting changed files..."
IFS=$'\n' read -r -a FILES_TO_LINT <<< "$CHANGED_FILES"
yarn lint "${FILES_TO_LINT[@]}"
while IFS= read -r file; do
if [[ $file == *.js || $file == *.ts || $file == *.tsx ]]; then
echo "linting file $file"
yarn lint "$file"
fi
done < /tmp/changed_files.txt
else
echo "No matched files to lint."
fi
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}
4 changes: 1 addition & 3 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ module.exports = defineConfig({
env: {
opensearch: 'localhost:9200',
opensearchDashboards: 'localhost:5601',
security_enabled: true,
security_enabled: false,
},
'cypress-watch-and-reload': {
watch: ['common/**', 'public/**', 'server/**'],
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./.cypress/plugins/index.js')(on, config);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ exports[`Live tail button starts live tail with 5s interval 1`] = `
size="m"
type="stop"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
Expand All @@ -167,8 +167,12 @@ exports[`Live tail button starts live tail with 5s interval 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButton__text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`Explorer Search component renders basic component 1`] = `
size="m"
type="arrowDown"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
Expand All @@ -124,8 +124,12 @@ exports[`Explorer Search component renders basic component 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButton__text"
Expand Down Expand Up @@ -556,7 +560,7 @@ exports[`Explorer Search component renders basic component 1`] = `
size="s"
type="arrowDown"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--small euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
Expand All @@ -573,16 +577,20 @@ exports[`Explorer Search component renders basic component 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButtonEmpty__text euiQuickSelectPopover__buttonText"
>
<EuiIcon
type="calendar"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon-isLoading"
focusable="false"
Expand All @@ -599,8 +607,12 @@ exports[`Explorer Search component renders basic component 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
</span>
</span>
Expand Down Expand Up @@ -746,7 +758,7 @@ exports[`Explorer Search component renders basic component 1`] = `
size="m"
type="refresh"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
Expand All @@ -763,8 +775,12 @@ exports[`Explorer Search component renders basic component 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButton__text euiSuperUpdateButton__text"
Expand Down Expand Up @@ -868,7 +884,7 @@ exports[`Explorer Search component renders basic component 1`] = `
size="m"
type="play"
>
<EuiIconEmpty
<EuiIconBeaker
aria-hidden={true}
className="euiIcon euiIcon--medium euiIcon--inherit euiIcon-isLoading euiButtonContent__icon"
focusable="false"
Expand All @@ -885,8 +901,12 @@ exports[`Explorer Search component renders basic component 1`] = `
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
/>
</EuiIconEmpty>
>
<path
d="M5.277 10.088c.02.014.04.03.057.047.582.55 1.134.812 1.666.812.586 0 1.84-.293 3.713-.88L9 6.212V2H7v4.212l-1.723 3.876Zm-.438.987L3.539 14h8.922l-1.32-2.969C9.096 11.677 7.733 12 7 12c-.74 0-1.463-.315-2.161-.925ZM6 2H5V1h6v1h-1v4l3.375 7.594A1 1 0 0 1 12.461 15H3.54a1 1 0 0 1-.914-1.406L6 6V2Z"
/>
</svg>
</EuiIconBeaker>
</EuiIcon>
<span
className="euiButton__text"
Expand Down
Loading