From 445e1088491faaffed5698a13a4ea6b759d952d9 Mon Sep 17 00:00:00 2001 From: Rupal Mahajan Date: Thu, 21 Mar 2024 14:06:50 -0700 Subject: [PATCH] Update tests (#69) Signed-off-by: Rupal Mahajan --- .github/workflows/reporting-cli-test-workflow.yml | 8 ++++---- test/errors.test.js | 9 +-------- test/format.test.js | 2 +- test/misc.test.js | 10 ---------- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/.github/workflows/reporting-cli-test-workflow.yml b/.github/workflows/reporting-cli-test-workflow.yml index 29c881b..70d96d2 100644 --- a/.github/workflows/reporting-cli-test-workflow.yml +++ b/.github/workflows/reporting-cli-test-workflow.yml @@ -44,14 +44,14 @@ jobs: with: timeout_seconds: 1 max_attempts: 30 - command: curl https://localhost:9200 -ku 'admin:admin' + command: curl https://localhost:9200 -ku 'admin:myStrongPassword123!' retry_wait_seconds: 30 - name: Add sample data run: | - curl -XPOST -u 'admin:admin' 'http://localhost:5601/api/sample_data/ecommerce' -H 'osd-xsrf:true' - curl -XPOST -u 'admin:admin' 'http://localhost:5601/api/sample_data/logs' -H 'osd-xsrf:true' -H 'securitytenant: global' - curl -XPOST -u 'admin:admin' 'http://localhost:5601/api/sample_data/flights' -H 'osd-xsrf:true' -H 'securitytenant: admin_tenant' + curl -XPOST -u 'admin:myStrongPassword123!' 'http://localhost:5601/api/sample_data/ecommerce' -H 'osd-xsrf:true' + curl -XPOST -u 'admin:myStrongPassword123!' 'http://localhost:5601/api/sample_data/logs' -H 'osd-xsrf:true' -H 'securitytenant: global' + curl -XPOST -u 'admin:myStrongPassword123!' 'http://localhost:5601/api/sample_data/flights' -H 'osd-xsrf:true' -H 'securitytenant: admin_tenant' - name: Run integration tests run: | diff --git a/test/errors.test.js b/test/errors.test.js index 92555fa..4f1f642 100644 --- a/test/errors.test.js +++ b/test/errors.test.js @@ -33,15 +33,8 @@ describe('download report errors', () => { expect(result.stderr).toContain('error: option \'-f, --format \' argument \'txt\' is invalid. Allowed choices are pdf, png, csv.'); }); - test('invalid tenant', async () => { - let result = await cli(['-u', `${url}/app/dashboards#/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b`, '-a', 'basic', '-c', credentials, - '-t', 'custom'], '.'); - expect(result.code).toBe(1); - expect(result.stderr).toContain('Invalid tenant'); - }, 150000); - test('saved search error', async () => { - let result = await cli(['-u', `${url}/app/discover#/`, '-a', 'basic', '-c', credentials, '-f', 'csv'], '.'); + let result = await cli(['-u', `${url}/app/data-explorer/discover#/`, '-a', 'basic', '-c', credentials, '-f', 'csv'], '.'); expect(result.code).toBe(1); expect(result.stderr).toContain('Please save search and retry'); }, 150000); diff --git a/test/format.test.js b/test/format.test.js index a0efb0f..ca5c44d 100644 --- a/test/format.test.js +++ b/test/format.test.js @@ -37,7 +37,7 @@ describe('report format option', () => { }, 30000); test('download csv report', async () => { - let result = await cli(['-u', `${url}/app/discover#/view/3ba638e0-b894-11e8-a6d9-e546fe2bba5f`, '-a', 'basic', '-c', credentials, + let result = await cli(['-u', `${url}/app/data-explorer/discover#/view/3ba638e0-b894-11e8-a6d9-e546fe2bba5f`, '-a', 'basic', '-c', credentials, '-n', 'testdownloadcsv', '-f', 'csv'], '.'); expect(result.code).toBe(0); const expectedFile = './testdownloadcsv.csv'; diff --git a/test/misc.test.js b/test/misc.test.js index 1997d28..20dc8e5 100644 --- a/test/misc.test.js +++ b/test/misc.test.js @@ -19,14 +19,4 @@ describe('download report errors', () => { expect(stats.size >= 0).toBeTruthy(); fs.unlinkSync(expectedFile); }, 150000); - - test('download csv report from custom tenant', async () => { - let result = await cli(['-u', `${url}/app/discover#/view/571aaf70-4c88-11e8-b3d7-01146121b73d`, '-a', 'basic', '-c', credentials, - '-n', 'testcsvoncustomtenant', '-t', 'admin_tenant', '-f', 'csv'], '.'); - expect(result.code).toBe(0); - const expectedFile = './testcsvoncustomtenant.csv'; - const stats = fs.statSync(expectedFile); - expect(stats.size >= 0).toBeTruthy(); - fs.unlinkSync(expectedFile); - }, 150000); });