Skip to content

Commit

Permalink
chore: increase test timeout before test refactor (#1496)
Browse files Browse the repository at this point in the history
making node test runs slightly more durable. Hopefully
  • Loading branch information
jkaster authored Sep 10, 2024
1 parent 8fca72b commit bd34fa8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tssdk-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
68 changes: 37 additions & 31 deletions packages/sdk-node/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
});
}
});
});
Expand Down

0 comments on commit bd34fa8

Please sign in to comment.