Skip to content

Integration Tests for testnet.polykey.com #71

@emmacasolin

Description

@emmacasolin

Specification

We need a suite of tests to cover interacting with a deployed agent, which we can do using testnet.polykey.io. These tests need to cover various different connection scenarios:

  • Connecting to a deployed agent as a seed node during startup
  • Pinging a deployed agent
  • Using the deployed agent as a signaller (and eventually a relay once this is implemented)
  • Tests for when the deployed agent is contacting an agent behind a NAT (NAT-Traversal Testing with testnet.polykey.io Polykey#159)
  • Any bugs that are discovered during the above tasks

These tests should go into their own subdirectory tests/testnet and should not be run with the other tests. They should be disabled in our jest config and should only run when explicitly called (which will happen during the integration stage of our pipelines).

Required tests:

  • tests/testnet/testnetConnection.test.ts
    • Can connect to the testnet
      • Within a reasonable amount of time
      • Without errors/shutting down the local agent
      • Without errors/shutting down the testnet
    • Can disconnect from the testnet
      • Within a reasonable amount of time
      • Without errors/shutting down the local agent
      • Without errors/shutting down the testnet
    • Can reconnect to the testnet
      • Able to handle different node ids (testnet is a cluster of nodes)
  • tests/testnet/testnetPing.test.ts
    • Can ping the testnet
      • Able to handle different node ids (testnet is a cluster of nodes)
    • Can ping another node via the testnet (signaling)
    • Can ping another node via the testnet (relay)
    • Can attempt to ping another node that doesn't exist
      • Without shutting down the testnet
  • tests/testnet/testnetNAT.test.ts
    • Can ping a node that is behind endpoint-independent NAT via the testnet
      • From a node that is not behind a NAT (DMZ)
      • From a node that is behind endpoint-independent NAT
      • From a node that is behind endpoint-dependent NAT
    • Can ping a node that is behind endpoint-dependent NAT via the testnet
      • From a node that is not behind a NAT (DMZ)
      • From a node that is behind endpoint-independent NAT
      • From a node that is behind endpoint-dependent NAT
  • Should also incorporate tests from Testnet Deployment Polykey#326 (comment)

Additional context

Tasks

  • 1. Attempt connections to the deployed seed node and create issues for all bugs discovered (and resolve them)
  • 2. Create tests for simple connections to testnet.polykey.io
    • 1 node connected to testnet.polykey.io and maintains connection
    • 2 nodes connected to testnet.polykey.io and can ping each other (they will have the same IP but different ports)
  • [ ] 3. Create tests for edge cases and previous bugs - most edge cases will go to the simulation suite
  • [ ] 4. Create tests for connecting to a deployed seed node from behind a NAT - this can only be done as part of a simulation suite, since we don't control host firewalls
  • 5. Finish off all diagrams as part of NAT testing Add diagrams to NAT Traversal tests Polykey#388
  • 6. Add new INFO level logs for situations where connections are going into stopping. This is next to the debug logs.
  • [ ] 7. Add a logging debug filter to command line arguments to take a regular expression. Should be global option like --log='/regex/'. - not relevant to integration testing, the js-logger does support REGEX filtering, but the PK CLI currently doesn't have this option.
  • [ ] 8. Use https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerOverride.html to be able to easily try different debugging levels and filters. - cannot use container overrides in services, can be done as part of tasks though, will have to just redeploy service with different task definition each time
  • [ ] 9. agent status command needs to display useful information like the polykey version and other useful statistics like active connections, number of node graph entries etc etc.
  • [ ] 10. --client-host needs to support host names. - this is pending a change to being able to use PolykeyClient to connect to a host name - which would require using the DNS-SD SRV records. This still needs to be specced out how this would work because in some cases you want to connect to a SINGLE Node, in other cases you are "discovering" a node to connect to, but it's not relevant to this epic.
  • 11. EC2 setup with idempotency
  • 12. Multi Node Setup on AWS
  • 13. Recovery Code Pool on AWS
  • 14. Multi-Host DNS resolution
  • 15. Multi Node Resolver
  • 16. NodeGraph KeyPath to lift Host and Port to the key path
  • 17. Put the trusted testnet seed nodes into the src/config.ts - from Infrastructure setup for testnet should automate multiple instances for multiple nodes Polykey#488

Emergent bugs

Sub-issues

Metadata

Metadata

Labels

developmentStandard developmentepicBig issue with multiple subissuesr&d:polykey:core activity 4End to End Networking behind Consumer NAT Devices

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions