feat: add task status reporting load generator runner (#20538)

Adds the Runner, Config, and Metrics for the scaletest load generator for task status.

Part of https://github.com/coder/internal/issues/913
This commit is contained in:
Spike Curtis
2025-11-13 16:53:02 +04:00
committed by GitHub
parent 5bfbb0301f
commit a3c851c0e6
6 changed files with 1001 additions and 0 deletions
+30
View File
@@ -2,7 +2,9 @@ package testutil
import (
"context"
"io"
"strings"
"sync"
"testing"
"github.com/hashicorp/yamux"
@@ -51,3 +53,31 @@ func isQueryCanceledError(err error) bool {
}
return false
}
type testLogWriter struct {
t testing.TB
mu sync.Mutex
testOver bool
}
func NewTestLogWriter(t testing.TB) io.Writer {
w := &testLogWriter{t: t}
t.Cleanup(func() {
w.mu.Lock()
defer w.mu.Unlock()
w.testOver = true
})
return w
}
func (w *testLogWriter) Write(p []byte) (n int, err error) {
n = len(p)
w.mu.Lock()
defer w.mu.Unlock()
if w.testOver {
return n, nil
}
w.t.Logf("%q", string(p))
return n, nil
}