-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Specification
It's time to split up the test modules for these areas, this will our test performance, and give us understanding of the test coverage of all our API behaviour:
tests/bintests/agenttests/client
For tests/bin, each command can have its own test. Look at tests/bin/agent as a template for what to do. Right now all the other commands are single test modules in their own directory like tests/bin/identities/identities.test.ts. These should all be split up into individual commands. Note that most of the tests should be using the shared global agent. However some tests may be independent. This is where you can use the nested describe pattern as demonstrated in tests/bin/agent/status.test.ts.
Some tips:
- Use the global shared agent
- Use module mocking for prompting
- Use the correct
pkExec,pkStdio,pkSpawn,pkExpectutility - Use 1 nested describe at the bottom in case there is a need to use a the global shared agent and also have independent tests
- Make sure to revert all side effects in the global shared agent! In every test!
We may optimise it further when realising that some tests can just use their own agent instead of sharing the agent. This is because by using the global keypair, starting agents is really fast now. This will probably need to be used in the nodes commands anyway.
For tests/agent and tests/client, this is about the GRPC API. We have now split up each RPC handler into their own file, this allows much more isolated and specific unit testing of each handler. Refer to tests/client/service/agentStop.test.ts as the template for each handler test. All rpc*.test.ts should be converted appropriately. Refer to #249 when you have questions or discussions about API design. This is just about splitting the tests up, however we may find we can fix things up regarding the API as this issue is tackled.
Additional context
- Fix Concurrent Testing Scalability - Find Blocking Code, Make them Non-Blocking #264 - concurrent testing scalability should improve as we separate our tests out
- Adding QA jobs and expanding test jobs for CI/CD. #292 - PR for CI/CD that brought in changes that allows isolated GRPC API tests in for client service and agent service
- Transport Agnostic RPC #249 - Overall GRPC API review
- Fix node claims throughout
tests/#306 - Node claims tests are still broken and need to be fixed
Tasks
- Split up
tests/bin - Split up
tests/client/serviceand refer tosrc/client/serviceandtests/client/service/agentStop.test.ts - Split up
tests/agent/serviceand refer tosrc/agent/service - Check for other API conformance/design issues, such as error handling.