I can’t answer why, since it pertains to the underlying PocketIC server. Maybe @mraszyk can shine some light on that.
In the meantime, the best I could personally come up with for Motoko is to inject the canister ID at runtime using init args. For example here, and tested here.
RUN v2.0.4 /Users/daviddalbusco/projects/juno/juno
✓ src/tests/satellite.auth.spec.ts (16 tests) 5303ms
✓ src/tests/satellite.spec.ts (21 tests) 5416ms
✓ src/tests/satellite.storage.spec.ts (34 tests) 8230ms
✓ src/tests/console.storage.spec.ts (51 tests) 8418ms
✓ src/tests/orbiter.spec.ts (11 tests) 5656ms
✓ src/tests/satellite.datastore.spec.ts (18 tests) 14554ms
✓ src/tests/mission-control.set-unset.spec.ts (10 tests) 9910ms
✓ src/tests/satellite.custom-domains.spec.ts (11 tests) 4120ms
↓ src/tests/satellite.playground.spec.ts (1 test | 1 skipped)
✓ src/tests/console.custom-domains.spec.ts (9 tests) 4459ms
✓ src/tests/console.metadata.spec.ts (3 tests) 10443ms
✓ src/tests/console.spec.ts (1 test) 9457ms
✓ src/tests/console.upgrade.spec.ts (1 test) 18656ms
❯ src/tests/orbiter.upgrade.spec.ts (6 tests | 2 failed) 38849ms
× Orbiter upgrade > v0.0.6 -> v0.0.7 > Page views > should still list all entries after upgrade
→ Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
× Orbiter upgrade > v0.0.6 -> v0.0.7 > Page views > should be able to collect new entry and list both bounded and unbounded serialized data
→ Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
❯ src/tests/satellite.upgrade.spec.ts (14 tests | 1 failed) 81419ms
× Satellite upgrade > v0.0.15 -> v0.0.16 > should keep listing existing heap collections as such
→ Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL src/tests/orbiter.upgrade.spec.ts > Orbiter upgrade > v0.0.6 -> v0.0.7 > Page views > should still list all entries after upgrade
FAIL src/tests/orbiter.upgrade.spec.ts > Orbiter upgrade > v0.0.6 -> v0.0.7 > Page views > should be able to collect new entry and list both bounded and unbounded serialized data
FAIL src/tests/satellite.upgrade.spec.ts > Satellite upgrade > v0.0.15 -> v0.0.16 > should keep listing existing heap collections as such
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯
Test Files 2 failed | 12 passed | 1 skipped (15)
Tests 3 failed | 203 passed | 1 skipped (207)
Start at 14:27:51
Duration 85.43s (transform 354ms, setup 1ms, collect 4.22s, tests 224.89s, environment 2ms, prepare 1.45s)
Did you try increasing the test timeout? I’m using a pretty long 60,000ms in my own tests. They involve some pretty heaving lifting with a full NNS so you probably don’t need that long.
This limitation is dropped in the upcoming PocketIC release that I’m about to announce on the forum tonight. If you’re interested in more details why there was such a limitation, then I’m happy to share more about the PocketIC server internals.
Spotted this error, it should be resolved with adding more timeout?
❯ npm run test src/tests/mission-control.set-unset.spec.ts
> @junobuild/juno@0.0.31 test
> vitest src/tests/mission-control.set-unset.spec.ts
RUN v2.0.4 /Users/daviddalbusco/projects/juno/juno
Test Files no tests
Tests no tests
Start at 18:12:06
Duration 5.22s (transform 12ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: The PocketIC binary took too long to start. Please try again.
❯ intervalMs node_modules/@hadronous/pic/dist/pocket-ic-server.js:82:19
❯ Timeout.runPoll [as _onTimeout] node_modules/@hadronous/pic/dist/util/poll.js:10:32
close timed out after 10000ms
Tests closed successfully but something prevents Vite server from exiting
You can try to identify the cause by enabling "hanging-process" reporter. See https://vitest.dev/config/#reporters
I could successfully test this draft PR for bitcoin integration in PocketIC following the developer docs. So I’m hopeful we could get it released in a week or two.
AgentError: Server returned an error:
Code: 404 (Not Found)
Body:
at HttpAgent._HttpAgent_requestAndRetry (node_modules/@dfinity/agent/src/agent/http/index.ts:628:11)
at async HttpAgent._HttpAgent_requestAndRetry (node_modules/@dfinity/agent/src/agent/http/index.ts:626:14)
at async HttpAgent._HttpAgent_requestAndRetry (node_modules/@dfinity/agent/src/agent/http/index.ts:626:14)
at async HttpAgent._HttpAgent_requestAndRetry (node_modules/@dfinity/agent/src/agent/http/index.ts:626:14)
at async HttpAgent.status (node_modules/@dfinity/agent/src/agent/http/index.ts:968:22)
at async HttpAgent.fetchRootKey (node_modules/@dfinity/agent/src/agent/http/index.ts:980:24)
my pic url is PIC_URL http://127.0.0.1:54903 but maybe the server is setting something else upt to host the replica stuff?
The version of PocketIC used in the Pic-JS beta doesn’t yet expose the agent-compatible server so that won’t work. It’s a high priority for me to get this done, I just haven’t had much time recently.
But out of curiosity, what are you trying to do that you need it?
I think I thought that the agent was pulling the root from mainnet because I didn’t specify a host and I was using agent.fetchRootKey to get it(it may have been from main net). (I’m not quite sure because I found out all the keys start with the same prefix),I figure out that I needed to specify the host but that didn’t seem to work because, as you say, no HTTP agent. Eventually I figured out that I use NNS state I need to get the pub key of the nns subnet and if I only have a singe app subnet I can use that pub key. Code is working here: icrc75.mo/pic/icrc75/list.test.ts at 4899454fdf3f544376a4c116c1627279c6e2b901 · icdevsorg/icrc75.mo · GitHub