Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Antony1060 committed Jan 7, 2024
1 parent 7499388 commit 877d214
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
matrix:
suite: [server, worker]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -31,9 +34,10 @@ jobs:
working-directory: test

- run: bun install --global wrangler
if: ${{ matrix.suite == 'worker' }}

- name: Test
run: bun test
run: bun test ${{ matrix.suite }}
working-directory: test
env:
RPC_URL: https://rpc.ankr.com/eth
Expand Down
18 changes: 12 additions & 6 deletions test/tests/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,32 @@ afterAll(async () => {
server?.kill();
});

test_implementation('server/name', http_fetch('http://0.0.0.0:3000/n/'), dataset_name_single);
test_implementation('server/address', http_fetch('http://0.0.0.0:3000/a/'), dataset_address_single);
const PREFIX = 'server';

test_implementation(`${PREFIX}/name`, http_fetch('http://0.0.0.0:3000/n/'), dataset_name_single);
test_implementation(
`${PREFIX}/address`,
http_fetch('http://0.0.0.0:3000/a/'),
dataset_address_single
);
test_implementation(
'server/universal',
`${PREFIX}/universal`,
http_fetch('http://0.0.0.0:3000/u/'),
dataset_universal_single
);

test_implementation(
'server/bulk/name',
`${PREFIX}/bulk/name`,
http_fetch('http://0.0.0.0:3000/bulk/n?'),
dataset_name_bulk
);
test_implementation(
'server/bulk/address',
`${PREFIX}/bulk/address`,
http_fetch('http://0.0.0.0:3000/bulk/a?'),
dataset_address_bulk
);
test_implementation(
'server/bulk/universal',
`${PREFIX}/bulk/universal`,
http_fetch('http://0.0.0.0:3000/bulk/u?'),
dataset_universal_bulk
);
23 changes: 13 additions & 10 deletions test/tests/worker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ beforeAll(async () => {

console.log('Waiting for server to start...');

let attempts = 0;

// TODO: fix
// eslint-disable-next-line no-constant-condition
while (true) {
Expand All @@ -30,8 +28,7 @@ beforeAll(async () => {
console.log('Heartbeat succes!');
break;
} catch {
console.log('Waiting another 4s for heartbeat...');
attempts++;
console.log('Waiting another 1s for heartbeat...');
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
continue;
}
Expand All @@ -46,26 +43,32 @@ afterAll(async () => {
await server?.exited;
});

test_implementation('worker/name', http_fetch('http://0.0.0.0:3000/n/'), dataset_name_single);
test_implementation('worker/address', http_fetch('http://0.0.0.0:3000/a/'), dataset_address_single);
const PREFIX = 'worker';

test_implementation(`${PREFIX}/name`, http_fetch('http://0.0.0.0:3000/n/'), dataset_name_single);
test_implementation(
`${PREFIX}/address`,
http_fetch('http://0.0.0.0:3000/a/'),
dataset_address_single
);
test_implementation(
'worker/universal',
`${PREFIX}/universal`,
http_fetch('http://0.0.0.0:3000/u/'),
dataset_universal_single
);

test_implementation(
'worker/bulk/name',
`${PREFIX}/bulk/name`,
http_fetch('http://0.0.0.0:3000/bulk/n?'),
dataset_name_bulk
);
test_implementation(
'worker/bulk/address',
`${PREFIX}/bulk/address`,
http_fetch('http://0.0.0.0:3000/bulk/a?'),
dataset_address_bulk
);
test_implementation(
'worker/bulk/universal',
`${PREFIX}/bulk/universal`,
http_fetch('http://0.0.0.0:3000/bulk/u?'),
dataset_universal_bulk
);

0 comments on commit 877d214

Please sign in to comment.