Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions interop-test-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Interop Tests

For more info: https://github.com/libp2p/test-plans/tree/master/transport-interop#readme

## Requirements

To run the interop test framework locally, you need:

- Docker
- node, nvm and ts-node

## Running it locally

The first thing to be able to run the test locally is build the images of each livp2p implementation
being tested. You need to run the following steps for each one of the implementations that you are
planning to run:

1. Checkout the project https://github.com/libp2p.
2. Navigate to test-plans/impl/<IMPL>/<VERSION>; where <IMPL> is the implementation that you want to
build (e.g. `jvm`) and <VERSION> is what version you want (e.g. `v1.2`).
3. Once in the specific version folder run `make` to build the image. This will create a
`image.json` file with the hash of the Docker image built.

Once you have the images that you want, navigate back to the `transport-interop` folder and run:

```
npm test --name-filter=jvm-v1.2
```

The parameter `--name-filter` can be used to limit the pairs that are going to be executed.
In the previous example, only pairs with `jvm-1.2` are going to run.
Similarly, `--name-ignore` can be used to remove pairs.

Here is the output of a sample run:

```
npm test --name-filter=jvm-v1.2 --name-ignore=<OMMITED> --verbose=true

> @libp2p/[email protected] test
> ts-node src/compose-stdout-helper.ts && ts-node testplans.ts

Checking jvm-v1.2 x jvm-v1.2 (tcp, tls, mplex)...ACCEPTED (filter match: '*')
Running 1 tests
Running test spec: jvm-v1.2 x jvm-v1.2 (tcp, tls, mplex)
Finished: jvm-v1.2 x jvm-v1.2 (tcp, tls, mplex) { handshakePlusOneRTTMillis: 380, pingRTTMilllis: 2 }
0 failures []
Run complete
```
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class InteropTestParams(
if (transport != QUIC_V1) {
checkNonEmptyParam("security", security)
}
checkNonEmptyParam("redis_addr", redisAddress)

if (redisAddress == null || redisAddress!!.isBlank()) {
redisAddress = "redis:6379"
}

if (ip == null || ip!!.isBlank()) {
ip = "0.0.0.0"
Expand Down
44 changes: 19 additions & 25 deletions interop-test-client/src/test/resources/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
# Compose file used for testing locally
services:
listener:
build: .
environment:
transport: "tcp"
muxer: "mplex"
security: "tls"
is_dialer: false
redis_addr: "redis:6379"
test_timeout_seconds: 180
depends_on:
redis:
condition: service_started
dialer:
build: .
depends_on:
- redis
environment:
transport: "tcp"
muxer: "mplex"
security: "tls"
transport: tcp
is_dialer: true
redis_addr: "redis:6379"
test_timeout_seconds: 180
ip: 0.0.0.0
muxer: mplex
security: tls
listener:
init: true
build: .
depends_on:
redis:
condition: service_started
listener:
condition: service_started
- redis
environment:
transport: tcp
is_dialer: false
ip: 0.0.0.0
muxer: mplex
security: tls
redis:
image: "redis:7-alpine"
ports:
- "6379:6379"
image: redis:7-alpine
environment:
REDIS_ARGS: --loglevel warning
Loading