Holochain-gym Intermediate solution does not pass test

Hi all -

I am working through the Holochain gym exercises and, because I’m not quite certain about my dev environment, I wanted to use the solution branch to check that I can actually pass tests before starting to do the exercise by myself.

However, when I do this I am failing 3 tests as follows:

> demo-1@0.0.0 test /data/holochain/developer-exercises/intermediate/1.paths/tests
> TRYORAMA_LOG_LEVEL=info RUST_LOG=error RUST_BACKTRACE=1 TRYORAMA_HOLOCHAIN_PATH="holochain" ts-node src/index.ts

20:02:04 [tryorama] info: Using the following settings from environment variables:
20:02:04 [tryorama] info: {
  "adminInterfaceId": "tryorama-interface-admin",
  "appInterfaceId": "tryorama-interface-app",
  "stateDumpOnError": true,
  "zomeCallTimeoutMs": 90000,
  "conductorTimeoutMs": 125000,
  "strictConductorTimeout": false,
  "chooseFreePort": false,
  "logLevel": "info",
  "portRange": [
    33000,
    34000
  ],
  "legacy": false,
  "singletonAppId": "TRYORAMA_APP",
  "holochainPath": "holochain",
  "lairPath": "lair-keystore"
}
TAP version 13
# create posts and retrieve them
FIXME: ignoring onJoin
20:02:04 [tryorama] info: Spawning lair for test with keystore at:  /tmp/tmp.Fl9Hu8eyuu/tryorama/6oiI5r/keystore
20:02:04 [tryorama] info: Using conductor path:  holochain
20:02:04 [tryorama] info: Holochain version:     holochain 0.0.100

20:02:04 [tryorama] info: Conductor config path: /tmp/tmp.Fl9Hu8eyuu/tryorama/6oiI5r/conductor-config.yaml
20:02:04 info: 
☉☉☉ [[[CONDUCTOR c0]]]
☉ 
☉ ###HOLOCHAIN_SETUP###
☉ ###ADMIN_PORT:33000###
☉ ###HOLOCHAIN_SETUP_END###
☉ Conductor ready.
☉ 
20:02:04 [tryorama] info: Conductor 'c0' process spawning completed.
ok 1 should be truthy
ok 2 should be truthy
not ok 3 should be deeply equivalent
  ---
    operator: deepEqual
    expected: [ 'nature', 'giraffe' ]
    actual:   [ 'movie', 'nature', 'giraffe' ]
    at: <anonymous> (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:54:7)
    stack: |-
      Error: should be deeply equivalent
          at Test.assert [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:269:54)
          at Test.bound [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at Test.tapeDeepEqual (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:510:10)
          at Test.bound [as deepEqual] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at /data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:54:7
          at step (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:33:23)
          at Object.next (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:14:53)
          at fulfilled (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:5:58)
          at processTicksAndRejections (internal/process/task_queues.js:97:5)
  ...
ok 4 should be deeply equivalent
ok 5 should be deeply equivalent
ok 6 should be deeply equivalent
not ok 7 should be deeply equivalent
  ---
    operator: deepEqual
    expected: [ 'Inception', 'good morning' ]
    actual:   [ 'good morning', 'Inception' ]
    at: <anonymous> (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:93:7)
    stack: |-
      Error: should be deeply equivalent
          at Test.assert [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:269:54)
          at Test.bound [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at Test.tapeDeepEqual (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:510:10)
          at Test.bound [as deepEqual] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at /data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:93:7
          at step (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:33:23)
          at Object.next (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:14:53)
          at fulfilled (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:5:58)
          at processTicksAndRejections (internal/process/task_queues.js:97:5)
  ...
ok 8 should be deeply equivalent
not ok 9 should be deeply equivalent
  ---
    operator: deepEqual
    expected: [ 'Inception', 'good morning' ]
    actual:   [ 'good morning', 'Inception' ]
    at: <anonymous> (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:117:7)
    stack: |-
      Error: should be deeply equivalent
          at Test.assert [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:269:54)
          at Test.bound [as _assert] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at Test.tapeDeepEqual (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:510:10)
          at Test.bound [as deepEqual] (/data/holochain/developer-exercises/intermediate/1.paths/tests/node_modules/tape/lib/test.js:90:32)
          at /data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:117:7
          at step (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:33:23)
          at Object.next (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:14:53)
          at fulfilled (/data/holochain/developer-exercises/intermediate/1.paths/tests/src/index.ts:5:58)
          at processTicksAndRejections (internal/process/task_queues.js:97:5)
  ...
success for  create posts and retrieve them
20:02:26 [tryorama] info: conductor 'c0' exited with code null
FIXME: ignoring onLeave

1..9
# tests 9
# pass  6
# fail  3

npm ERR! Test failed.  See above for more details.

Two of them look like the result is just being returned in the wrong order but I wanted to make sure before going further! There is a high chance I did something stupid.

thank you - alex.

Hey! Thank you for finding this. The only real issue is the first one yes, I’ll investigate that more. Did you try to execute the code inside the nix shell as it says in the readme?

Thank you! yes, I am in nix-shell but I am using

nix-shell https://holochain.love

as per the announcement from early Feb, just in case that matters.

Yeah, I don’t think it matters that much in this case but it will for sure in other cases.

So in the readme for the exercise I tried to convey that the correct nix-shell to start is the one with the nix files already incorporated in the folder. Should I make this more explicit? This will get you the appropriate holochain version and everything else. If you want you can try to rerun the tests, although as I said in this particular case I don’t think it matters that much.

I must admit I get really confused about the interplay with nix, and have had real trouble getting it to work any other way except with holochain.love

going back into the folder developer-exercises/intermediate/1.paths and running nix-shell throws an error for me like this:

error: hash mismatch in file downloaded from 'https://github.com/holochain/holonix/tarball/master':
  wanted: sha256:032b2bmrijc7knpx3v5hi3j8zhgl4q5d942vnhzf49cbyb5dasq7
  got:    sha256:1kqfchszkzqa68g9q3wlpay8sfzx37b0yzj4hvw3a8jf7w2lzajj

and I don’t know what that really means (except obviously I have the wrong version of something). If you really need that nix-shell must be invoked from this directory - rather than any other way - then yes, I do think this could be clearer, maybe state as a critical prerequisite or something.

If you have any idea about how I could address this error I would love to know!

thank you - alex.

Hi Alex (@robot5x)

TL;DR; I had the same problem yesterday. I think I fixed the nix script and updated the repo. So if you do a git pull in the solution branch, I should work. I also updated the master branch.
Let me know if it works for you too.

Nix can be difficult to understand if somethings goes wrong, but it helps a lot with getting a consistent set of tooling, because for zome development you need the rust, typescript and holochain ecosystems to be correctly configured.
The problem is that we are not using tagged versions of the dependencies, yet. That means the SHA checksums change when these dependencies add or change stuff. And, unless I’m mistaken, the tagged versions are still pinned to an old incompatible version of Holochain. I think the new version is still evolving to fast for it to be tagged at the moment.

3 Likes

hey @tixel

yes it worked! thank you so much.
your explanation around nix and holochain was really helpful too.
:+1: alex.