Skip to content

feat(cli/exp): add app testing to scaletest workspace-traffic - #11633

Merged
mafredri merged 6 commits into
mainfrom
mafredri/scaletest-workspace-app-traffic
Jan 19, 2024
Merged

mafredri merged 6 commits into
mainfrom
mafredri/scaletest-workspace-app-traffic

Conversation

@mafredri

@mafredri mafredri commented Jan 16, 2024 •

Copy link
Copy Markdown
Member

This implementation is quite specific to our usage and only supports app communication over WebSocket. An example command/workspace template could look like this:

coder exp scaletest workspace-traffic --template scaletest-ws --app wsec --bytes-per-tick $((1024*100)) --tick-interval 1ms --job-timeout 10s
resource "coder_script" "websocat" {
  agent_id     = coder_agent.main.id
  display_name = "websocat"
  script       = <<EOF
curl -sSL -o /tmp/websocat https://github.com/vi/websocat/releases/download/v1.12.0/websocat.x86_64-unknown-linux-musl
chmod +x /tmp/websocat

/tmp/websocat --exit-on-eof --binary ws-l:127.0.0.1:1234 mirror: &
/tmp/websocat --exit-on-eof --binary ws-l:127.0.0.1:1235 cmd:'dd if=/dev/urandom' &
/tmp/websocat --exit-on-eof --binary ws-l:127.0.0.1:1236 cmd:'dd of=/dev/null' &
wait
EOF
  run_on_start = true
}

resource "coder_app" "ws_echo" {
  agent_id     = coder_agent.main.id
  slug         = "wsec" # Short slug so URL doesn't exceed limit: https://wsec--main--scaletest-UN9UmkDA-0--scaletest-SMXCCYVP-0--apps.big.cdr.dev
  display_name = "WebSocket Echo"
  url          = "http://localhost:1234"
  subdomain    = true
  share        = "authenticated"
}

resource "coder_app" "ws_random" {
  agent_id     = coder_agent.main.id
  slug         = "wsra" # Short slug so URL doesn't exceed limit: https://wsra--main--scaletest-UN9UmkDA-0--scaletest-SMXCCYVP-0--apps.big.cdr.dev
  display_name = "WebSocket Random"
  url          = "http://localhost:1235"
  subdomain    = true
  share        = "authenticated"
}

resource "coder_app" "ws_discard" {
  agent_id     = coder_agent.main.id
  slug         = "wsdi" # Short slug so URL doesn't exceed limit: https://wsdi--main--scaletest-UN9UmkDA-0--scaletest-SMXCCYVP-0--apps.big.cdr.dev
  display_name = "WebSocket Discard"
  url          = "http://localhost:1236"
  subdomain    = true
  share        = "authenticated"
}

Closes #11175 by relaxing the read/write assertion in tests, the exact byte count is unimportant since our goal is to produce load.

@mafredri
mafredri force-pushed the mafredri/scaletest-workspace-app-traffic branch 2 times, most recently from 96f25c3 to 748843c Compare January 16, 2024 12:50
@mafredri
mafredri force-pushed the mafredri/scaletest-workspace-app-traffic branch from 748843c to ef5cb9a Compare January 16, 2024 12:51

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the idea of app scaletests using an echo WebSocket server, but I can see it only in tests. Do you plan to deploy a similar solution in prod?

Comment thread cli/exp_scaletest.go Resolved
Comment thread cli/exp_scaletest.go Resolved
Comment thread scaletest/workspacetraffic/conn.go Resolved
Comment thread scaletest/workspacetraffic/run.go Resolved
Comment thread scaletest/workspacetraffic/run_test.go Resolved
Comment thread scaletest/workspacetraffic/run_test.go Resolved
@mafredri

Copy link
Copy Markdown
Member Author

I understand the idea of app scaletests using an echo WebSocket server, but I can see it only in tests. Do you plan to deploy a similar solution in prod?

The PR message contains an example for deploying it in prod, this is already added to a template in big.cdr.dev (will be added to all).

@mafredri
mafredri marked this pull request as ready for review January 19, 2024 11:25
@mafredri
mafredri requested a review from mtojek January 19, 2024 13:02

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mafredri
mafredri merged commit 73e6bbf into main Jan 19, 2024
@mafredri
mafredri deleted the mafredri/scaletest-workspace-app-traffic branch January 19, 2024 13:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flake: scaletest/workspacetraffic TestRun/RPTY

2 participants