From bd34fa824708bdb4d794eb158649995677f33d4b Mon Sep 17 00:00:00 2001 From: John Kaster Date: Tue, 10 Sep 2024 14:56:50 -0700 Subject: [PATCH] chore: increase test timeout before test refactor (#1496) making node test runs slightly more durable. Hopefully --- .github/workflows/tssdk-ci.yml | 2 +- package.json | 3 +- packages/sdk-node/test/sdk.test.ts | 68 ++++++++++++++++-------------- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/.github/workflows/tssdk-ci.yml b/.github/workflows/tssdk-ci.yml index 1cf4a69e0..c777a16df 100644 --- a/.github/workflows/tssdk-ci.yml +++ b/.github/workflows/tssdk-ci.yml @@ -169,7 +169,7 @@ jobs: ${{ github.workspace }}/.github/scripts/wait_for_looker.sh - name: Run Integration Tests - run: yarn test:node + run: yarn test:nodej - name: Upload integration test results if: ${{ always() }} diff --git a/package.json b/package.json index 1d3679bdc..95d780b6d 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,8 @@ "test:gen": "yarn jest packages/sdk-codegen", "test:redux": "yarn jest packages/redux", "test:sdk": "yarn jest packages/sdk", - "test:node": "glob -c \"tsx --test --test-timeout 60000 --test-reporter junit \" \"./packages/**/*.test.ts\"", + "test:node": "find . -name \"*.test.ts\" -not -path \"./node_modules/*\" -exec node --import tsx --test-timeout 90000 --test {} ';'", + "test:nodej": "find . -name \"*.test.ts\" -not -path \"./node_modules/*\" -exec node --import tsx --test-timeout 90000 --test-reporter junit --test {} ';'", "test:jest": "DOT_ENV_FILE=.env.test jest", "test:ext": "yarn jest packages/extension-sdk packages/extension-sdk-react", "test:hack": "yarn jest packages/wholly-artifact/src packages/hackathon", diff --git a/packages/sdk-node/test/sdk.test.ts b/packages/sdk-node/test/sdk.test.ts index f926cd9c8..3d86f5ccc 100644 --- a/packages/sdk-node/test/sdk.test.ts +++ b/packages/sdk-node/test/sdk.test.ts @@ -760,38 +760,44 @@ describe('LookerNodeSDK integration tests', () => { } }); - it('parses a query with no results', async () => { - const query = await sdk.ok( - sdk.create_query({ - model: 'system__activity', - view: 'dashboard', - limit: '2', - fields: ['dashboard.id', 'dashboard.title'], - filters: { 'dashboard.id': '-1' }, - }) - ); - expect(query).toBeDefined(); - expect(query.id).toBeDefined(); + describe('parses a query with no results', () => { + let query; + beforeAll(async () => { + query = await sdk.ok( + sdk.create_query({ + model: 'system__activity', + view: 'dashboard', + limit: '2', + fields: ['dashboard.id', 'dashboard.title'], + filters: { 'dashboard.id': '-1' }, + }) + ); + expect(query).toBeDefined(); + expect(query.id).toBeDefined(); + }); + for (const format of ['csv', 'json', 'json_detail', 'txt', 'md']) { - let failed = ''; - try { - const live = await sdk.ok( - sdk.run_query({ query_id: query.id!, result_format: format }) - ); - const cached = await sdk.ok( - sdk.run_query({ - query_id: query.id!, - result_format: format, - cache: true, - }) - ); - expect(live).not.toEqual('{}'); - expect(cached).not.toEqual('{}'); - } catch (e: any) { - failed = e.message; - console.info(JSON.stringify(e)); - } - expect(failed).toEqual(''); + it(`parses empty ${format} query`, async () => { + let failed = ''; + try { + const live = await sdk.ok( + sdk.run_query({ query_id: query.id!, result_format: format }) + ); + const cached = await sdk.ok( + sdk.run_query({ + query_id: query.id!, + result_format: format, + cache: true, + }) + ); + expect(live).not.toEqual('{}'); + expect(cached).not.toEqual('{}'); + } catch (e: any) { + failed = e.message; + console.info(JSON.stringify(e)); + } + expect(failed).toEqual(''); + }); } }); });