Tryorama failing even on a new hc project

So I was trying to make my test work in our project but then it seems like the hdk:get_entry call is not working properly. So, just to be sure, I reinstantiated a new hc project and tried to run the test there without altering anything on a freshly created zome which has a get_my_entry zome call and it still fails.

So here is where the test is actually failing

not ok 1 should be equivalent

---

operator: deepEqual

expected: |-

{ Ok: { App: [ 'my_entry', '{"content":"sample content"}' ] } }

actual: |-

{ Ok: null }

stack: |-

Error: should be equivalent

at Test.assert [as _assert] (/Users/lc/Desktop/example/test/node_modules/tape/lib/test.js:228:54)

at Test.bound [as _assert] (/Users/lc/Desktop/example/test/node_modules/tape/lib/test.js:80:32)

at Test.tapeDeepEqual (/Users/lc/Desktop/example/test/node_modules/tape/lib/test.js:426:10)

at Test.bound [as deepEqual] (/Users/lc/Desktop/example/test/node_modules/tape/lib/test.js:80:32)

at /Users/lc/Desktop/example/test/index.js:59:5

at processTicksAndRejections (internal/process/task_queues.js:93:5)

...

here’s my js

const path = require('path')

const { Orchestrator, Config, combine, singleConductor, localOnly, tapeExecutor } = require('@holochain/tryorama')

process.on('unhandledRejection', error => {
  console.error('got unhandledRejection:', error);
});

const dnaPath = path.join(__dirname, "../dist/example.dna.json")

const orchestrator = new Orchestrator({
  middleware: combine(
    tapeExecutor(require('tape')),
    localOnly,
    singleConductor,
  ),
})

const dna = Config.dna(dnaPath, 'scaffold-test')
const conductorConfig = Config.gen(
  {myInstanceName: dna},
  {
    network: {
      type: "sim2h",
      sim2h_url: "ws://localhost:8888"
    },
  }
  )

orchestrator.registerScenario("description of example test", async (s, t) => {

  const {alice, bob} = await s.players({alice: conductorConfig, bob: conductorConfig}, true)

  const addr = await alice.call("myInstanceName", "hello", "create_my_entry", {"entry" : {"content":"sample content"}})

  await s.consistency()

  const result = await bob.call("myInstanceName", "hello", "get_my_entry", {"address": addr.Ok})

  t.deepEqual(result, { Ok: { App: [ 'my_entry', '{"content":"sample content"}' ] } })
})

orchestrator.run()

It seems like the get_entry call is returning a null but then when i tried to call the get_entry call from Insomnia it had no problem in retrieving the entry I just made. Sorry in advance if this is such a beginner question. I feel like I’m missing something very obvious here.

Would appreciate anyone’s help.
Thanks!

Hi @tats_sato, it might be because the two Alice and Bob agents are not able to talk to each other (Alice creates the entry and Bob retrieves it). Do you have a sim2h_server running at localhost:8888?

If so, maybe the issue is somewhere else, but I fail to see where it would be… Also looking at the logs to see if there is some connection issue with the sim2h_server might help.

hi guillem!

Actually yeah… I made alice call the get_entry call and the test passed…

Okay so I checked the sim2h github and the default server was 9000…
Now the test is passing even when bob calls it.
Should have checked it before I asked here. But thank you guillem!!
Appreciate your help.

1 Like