Skip to content

Commit

Permalink
Update tests (#69)
Browse files Browse the repository at this point in the history
Signed-off-by: Rupal Mahajan <[email protected]>
  • Loading branch information
rupal-bq authored Mar 21, 2024
1 parent 51f8869 commit 445e108
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/reporting-cli-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 1 addition & 8 deletions test/errors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,8 @@ describe('download report errors', () => {
expect(result.stderr).toContain('error: option \'-f, --format <type>\' 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);
Expand Down
2 changes: 1 addition & 1 deletion test/format.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 0 additions & 10 deletions test/misc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit 445e108

Please sign in to comment.