Skip to content

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

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

Merged
merged 6 commits into from
Jan 19, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jan 16, 2024

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
Copy link
Member

@mtojek mtojek left a comment

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?

@mafredri
Copy link
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
Copy link
Member

@mtojek mtojek left a comment

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