Skip to content

Commit 201fc00

Browse files
committed
fix(e2e): avoid t.Skip from goroutine in concurrent RDP test
Pre-build xfreerdp args (which may call t.Skip) on the test goroutine, then pass them into worker goroutines that only call tryConnectFreeRDP.
1 parent 0cecc97 commit 201fc00

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

e2e/pam/rdp_test.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,23 @@ func TestPAM_RDP(t *testing.T) {
377377
var wg sync.WaitGroup
378378
errs := make([]error, numClients)
379379

380+
type proxyInfo struct {
381+
port int
382+
args []string
383+
}
384+
proxies := make([]proxyInfo, numClients)
380385
for i := 0; i < numClients; i++ {
381-
proxyPort := helpers.GetFreePort()
382-
startRDPProxy(t, ctx, infra, resourceName, "rdp-concurrent-account", "5m", proxyPort)
386+
port := helpers.GetFreePort()
387+
startRDPProxy(t, ctx, infra, resourceName, "rdp-concurrent-account", "5m", port)
388+
proxies[i] = proxyInfo{port: port, args: buildFreeRDPArgs(t, rdpBinary, "127.0.0.1", port, "testuser", "")}
389+
}
383390

391+
for i, p := range proxies {
384392
wg.Add(1)
385-
go func(idx, port int) {
393+
go func(idx int, args []string) {
386394
defer wg.Done()
387-
errs[idx] = connectFreeRDP(t, ctx, rdpBinary, "127.0.0.1", port, "testuser", "", 10*time.Second)
388-
}(i, proxyPort)
395+
errs[idx] = tryConnectFreeRDP(ctx, args, 10*time.Second)
396+
}(i, p.args)
389397
}
390398

391399
wg.Wait()

0 commit comments

Comments
 (0)