Skip to content

Commit

Permalink
Merge branch 'main' into fix-bundle-snapshot-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyl authored Feb 7, 2024
2 parents 5cb74b9 + 34a2630 commit 87ca867
Show file tree
Hide file tree
Showing 50 changed files with 969 additions and 180 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/assistant-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ jobs:
tests:
- 'cypress/**/dashboards-assistant/**'
tests:
tests-with-security:
needs: changes
if: ${{ needs.changes.outputs.tests == 'true' }}
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: dashboards assistant
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
osd-serve-args: --assistant.chat.enabled=true --assistant.chat.rootAgentName="Cypress test agent"
osd-serve-args: --assistant.chat.enabled=true

tests-without-security:
needs: changes
if: ${{ needs.changes.outputs.tests == 'true' }}
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: dashboards assistant
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
osd-serve-args: --assistant.chat.enabled=true
security-enabled: false
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-chrome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-chromium-ad-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-chromium-ism-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-chromium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-signoff-firefox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
# Disable command log to unhang
CYPRESS_NO_COMMAND_LOG: 1
steps:
- name: Checkout functional-test
uses: actions/checkout@v2
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/remote-cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ on:
branch_ref:
description: 'Test branch name or commit reference id'
required: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
trigger-cypress:
runs-on: ubuntu-latest
Expand All @@ -27,10 +28,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run Bash Script
env:
GITHUB_SECRET_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Remote Cypress Orchestrator Script
if: github.event_name == 'workflow_dispatch'
run: |
echo "Executing remoteCypress script for workflow_dispatch event"
./remoteCypress.sh -r "${{ github.event.inputs.repo }}" -w "${{ github.event.inputs.workflow_name }}" -o "${{ github.event.inputs.os_url }}" -d "${{ github.event.inputs.osd_url }}" -b "${{ github.event.inputs.branch_ref }}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"persistent": {
"plugins.ml_commons.only_run_on_ml_node": false,
"plugins.ml_commons.memory_feature_enabled": true,
"plugins.ml_commons.agent_framework_enabled": true,
"plugins.ml_commons.trusted_connector_endpoints_regex": [
"^http://127.0.0.1:3000$"
]
Expand Down
70 changes: 70 additions & 0 deletions cypress/fixtures/plugins/dashboards-assistant/security-cert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/**
* This file should be somewhere else like plugins/security but as assistant is the only consumer of the content
* Would be better to keep within the directory of dashboards-assistant.
*/

export const certPublicKeyContent = `
-----BEGIN CERTIFICATE-----
MIIEmDCCA4CgAwIBAgIUZjrlDPP8azRDPZchA/XEsx0X2iYwDQYJKoZIhvcNAQEL
BQAwgY8xEzARBgoJkiaJk/IsZAEZFgNjb20xFzAVBgoJkiaJk/IsZAEZFgdleGFt
cGxlMRkwFwYDVQQKDBBFeGFtcGxlIENvbSBJbmMuMSEwHwYDVQQLDBhFeGFtcGxl
IENvbSBJb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WfsPd2yStI+WD/5PU1Doo
1RyeHJO7s3ug8JPbtNJmaJwHe9nXBb/HXFdqb976yQKBgQDNYhpu+MYSYupaYqjs
9YFmHQNKpNZqgZ4ceRFZ6cMJoqpI5dpEMqToFH7tpor72Lturct2U9nc2WR0HeEs
/6tiptyMPTFEiMFb1opQlXF2ae7LeJllntDGN0Q6vxKnQV+7VMcXA0Y8F7tvGDy3
qJu5lfvB1mNM2I6y/eMxjBuQhwKBgQC6K41DXMFro0UnoO879pOQYMydCErJRmjG
/tZSy3Wj4KA/QJsDSViwGfvdPuHZRaG9WtxdL6kn0w1exM9Rb0bBKl36lvi7o7xv
M+Lw9eyXMkww8/F5d7YYH77gIhGo+RITkKI3+5BxeBaUnrGvmHrpmpgRXWmINqr0
0jsnN3u0OQKBgCf45vIgItSjQb8zonLz2SpZjTFy4XQ7I92gxnq8X0Q5z3B+o7tQ
K/4rNwTju/sGFHyXAJlX+nfcK4vZ4OBUJjP+C8CTjEotX4yTNbo3S6zjMyGQqDI5
9aIOUY4pb+TzeUFJX7If5gR+DfGyQubvvtcg1K3GHu9u2l8FwLj87sRzAoGAflQF
RHuRiG+/AngTPnZAhc0Zq0kwLkpH2Rid6IrFZhGLy8AUL/O6aa0IGoaMDLpSWUJp
nBY2S57MSM11/MVslrEgGmYNnI4r1K25xlaqV6K6ztEJv6n69327MS4NG8L/gCU5
3pEm38hkUi8pVYU7in7rx4TCkrq94OkzWJYurAkCgYATQCL/rJLQAlJIGulp8s6h
mQGwy8vIqMjAdHGLrCS35sVYBXG13knS52LJHvbVee39AbD5/LlWvjJGlQMzCLrw
F7oILW5kXxhb8S73GWcuMbuQMFVHFONbZAZgn+C9FW4l7XyRdkrbR1MRZ2km8YMs
/AHmo368d4PSNRMMzLHw8Q==
-----END PRIVATE KEY-----
`;
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('date_nanos', () => {
});
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');

cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('date_nanos_mixed', () => {
});
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');

const fromTime = 'Jan 1, 2019 @ 00:00:00.000';
const toTime = 'Jan 1, 2019 @ 23:59:59.999';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ const indexSet = [

describe('discover app', { scrollBehavior: false }, () => {
before(() => {
if (Cypress.env('SECURITY_ENABLED')) {
/**
* Security plugin is using private tenant as default.
* So here we'd need to set global tenant as default manually.
*/
cy.changeDefaultTenant({
multitenancy_enabled: true,
private_tenant_enabled: true,
default_tenant: 'global',
});
}
CURRENT_TENANT.newTenant = 'global';
// import logstash functional
testFixtureHandler.importJSONDocIfNeeded(
Expand All @@ -51,6 +62,7 @@ describe('discover app', { scrollBehavior: false }, () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

Expand All @@ -59,6 +71,9 @@ describe('discover app', { scrollBehavior: false }, () => {
describe('save search', () => {
const saveSearch1 = 'Save Search # 1';
const saveSearch2 = 'Modified Save Search # 1';
beforeEach(() => {
cy.switchDiscoverTable('new');
});

it('should show correct time range string by timepicker', function () {
cy.verifyTimeConfig(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
Expand Down Expand Up @@ -135,6 +150,7 @@ describe('discover app', { scrollBehavior: false }, () => {
const toTime = 'Jun 12, 1999 @ 11:21:04.000';

before(() => {
cy.switchDiscoverTable('new');
cy.setTopNavDate(fromTime, toTime);
});

Expand Down Expand Up @@ -248,6 +264,10 @@ describe('discover app', { scrollBehavior: false }, () => {
});

describe('refresh interval', function () {
beforeEach(() => {
cy.switchDiscoverTable('new');
});

it('should refetch when autofresh is enabled', () => {
cy.getElementByTestId('openInspectorButton').click();
cy.getElementByTestId('inspectorPanel')
Expand All @@ -265,12 +285,15 @@ describe('discover app', { scrollBehavior: false }, () => {
.should('be.visible')
.clear()
.type('2');

cy.makeDatePickerMenuOpen();
cy.getElementByTestId('superDatePickerToggleRefreshButton').click();

// Let auto refresh run
cy.wait(100);

// Close the auto refresh
cy.makeDatePickerMenuOpen();
cy.getElementByTestId('superDatePickerToggleRefreshButton').click();

// Check the timestamp of the last request, it should be different than the first timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('doc link in discover', () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('discover doc table', () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ describe('discover tab', () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.switchDiscoverTable('new');
cy.waitForSearch();
});

after(() => {});

describe('field data', function () {
before(() => {
cy.switchDiscoverTable('new');
});

it('search php should show the correct hit count', function () {
const expectedHitCount = '445';
cy.setTopNavQuery('php');
Expand All @@ -65,12 +70,18 @@ describe('discover tab', () => {
});

it('search type:apache should show the correct hit count', () => {
// add this line to address flakiness in Cypress:
// ensures stable switching to the new Discover table format.
cy.switchDiscoverTable('new');
const expectedHitCount = '11,156';
cy.setTopNavQuery('type:apache');
cy.verifyHitCount(expectedHitCount);
});

it('doc view should show Time and _source columns', function () {
// add this line to address flakiness in Cypress:
// ensures stable switching to the new Discover table format.
cy.switchDiscoverTable('new');
cy.getElementByTestId('dataGridHeaderCell-@timestamp').should(
'be.visible'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('index pattern with encoded id', () => {

// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.switchDiscoverTable('new');
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
cy.waitForLoader();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('index pattern without field spec', () => {
// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.waitForLoader();
cy.switchDiscoverTable('new');
});

after(() => {
Expand All @@ -49,6 +50,7 @@ describe('index pattern without field spec', () => {

it('should display a timepicker after switching to an index pattern with timefield', () => {
const indexName = 'with-timefield';
cy.switchDiscoverTable('new');
cy.getElementByTestId('comboBoxToggleListButton')
.should('be.visible')
.click();
Expand Down
Loading

0 comments on commit 87ca867

Please sign in to comment.