Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: add ping testplan for JS (browser) #74

Closed
wants to merge 13 commits into from
3 changes: 3 additions & 0 deletions ping/_compositions/js.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[custom]

[[groups]]
3 changes: 3 additions & 0 deletions ping/js/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules
**/Dockerfile
**/*.bundle.js
2 changes: 2 additions & 0 deletions ping/js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.bundle.js
node_modules/
2 changes: 2 additions & 0 deletions ping/js/.testgroundignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.bundle.js
node_modules/
40 changes: 40 additions & 0 deletions ping/js/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Get the base image of Node version 16
FROM node:16

# Get the latest version of Playwright
FROM mcr.microsoft.com/playwright:v1.27.1-focal

RUN apt-get update && \
apt-get -y install \
libnss3 libatk-bridge2.0-0 libdrm-dev \
libxkbcommon-dev libgbm-dev libasound-dev \
libatspi2.0-0 libxshmfence-dev \
libevent-2.1-7 libenchant-2-2 \
socat && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /plan

ARG PLAN_PATH="./"

COPY ./plan/${PLAN_PATH}package*.json ./plan/

WORKDIR /plan
RUN npm ci

COPY ./plan/${PLAN_PATH}*.js /plan/
COPY ./plan/${PLAN_PATH}src /plan/src
COPY ./plan/${PLAN_PATH}runtime /plan/runtime

RUN npm run webpack
RUN npm cache clean --force

ARG TEST_BROWSER_DEBUG_PORT=9222
ARG TEST_KEEP_OPENED_BROWSERS=false

EXPOSE ${TEST_BROWSER_DEBUG_PORT}

ENV TEST_BROWSER_DEBUG_PORT=${TEST_BROWSER_DEBUG_PORT}
ENV TEST_KEEP_OPENED_BROWSERS=false

ENTRYPOINT [ "npm", "run", "start" ]
44 changes: 44 additions & 0 deletions ping/js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Compatibility JS: Ping Test

## Run in isolation

You can run the test in isolation by importing and running it manually:

```
testground plan import --from ./ping/js --name compatibility-js
```

In a different shell:

```
testground daemon
```

Back to the original shell:

```
testground run single \
--plan compatibility-js \
--testcase ping \
--instances 2 \
--builder docker:generic \
--runner local:docker \
--wait
```

This will run the ping test between two NodeJS instances.

You can do the same between for example two chromium instances:

```
testground run single \
--plan compatibility-js \
--testcase ping \
--instances 2 \
--builder docker:generic \
--runner local:docker \
--tp runtime=chromium \
--wait
```

This will run the ping test between two chromium instances.
29 changes: 29 additions & 0 deletions ping/js/manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name = "compatibility-js"

[defaults]
builder = "docker:node"
runner = "local:docker"

[builders."docker:node"]
enabled = true

[builders."docker:generic"]
enabled = true

[builders."docker:generic".build_args]
TEST_BROWSER_DEBUG_PORT = "5321"
TEST_KEEP_OPENED_BROWSERS = "false"

[runners."local:docker"]
enabled = true

[runners."local:docker".exposed_ports]
CHROME_DEBUG = "5321"

[[testcases]]
name = "ping"
instances = { min = 2, max = 10000, default = 5 }

[testcases.params]
max_latency_ms = { type = "int", desc = "maximum value for random local link latency", unit = "ms", default = 1000 }
iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 }
Loading