testground / sdk-js

Other
1 stars 3 forks source link

Correct way to setup the js sdk? (testground example not working) #21

Closed laurentsenta closed 2 years ago

laurentsenta commented 2 years ago

I'm trying to run the example-js in the main testground repo but the job outcome is "failed" despite the test running successfully, Details in: https://github.com/testground/testground/issues/1303

I'm still getting started with the testground architecture, it looks like we expect the test to send a success signal to the sync service:

https://github.com/testground/sdk-js/blob/3124743eb2d8cac08e7697bc1d051c2d4dc18a58/src/runtime/events.js#L59-L61

but this emitter is initialized with null: https://github.com/testground/sdk-js/blob/3124743eb2d8cac08e7697bc1d051c2d4dc18a58/src/runtime/index.js#L36-L50

and never set: https://github.com/testground/sdk-js/search?q=setSignalEmitter https://github.com/testground/testground/search?q=setSignalEmitter

In the case of the go example we use a helper function that initializes the signal emitter: https://github.com/testground/testground/blob/master/plans/network/main.go#L9 https://github.com/testground/sdk-go/blob/d78f61eccaa37b0d941f98650bce5dbb8fd7b7f1/run/invoker.go#L169-L173

laurentsenta commented 2 years ago

Adding the signal event at the end of the ping-pong test will make it pass

    runenv.recordMessage("ping pong");
    await pingPong("10", 20, 35);

    // here vvv
    await client.signalEvent({
      success_event: {
        group: runenv.runParams.testGroupId,
      },
    });
  } finally {
    client.close();
    if (server) server.close();
    if (socket) socket.destroy();
  }
laurentsenta commented 2 years ago

Self assigning, I'll implement a fix for this but @hacdias if you have some advice on this, I'm sure that would help me a lot