Skip to content

Commit d7bdb3c

Browse files
ci: add paralleltestctx to lint/go (#19369)
Closes coder/internal#884 We're adding this as a `go run` in `lint/go` for now, since adding it to golangci-lint ourselves involves recompiling golangci-lint and then running that new binary. I'll look into proposing it being added to the public golangci-lint linters. Doesn't appear to cause the lint ci job to take any longer, which is nice.
1 parent 1d1a16e commit d7bdb3c

File tree

8 files changed

+11
-4
lines changed

8 files changed

+11
-4
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ lint/go:
576576
./scripts/check_codersdk_imports.sh
577577
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2)
578578
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run
579+
go run github.com/coder/paralleltestctx/cmd/paralleltestctx@v0.0.1 -custom-funcs="testutil.Context" ./...
579580
.PHONY: lint/go
580581

581582
lint/examples:

agent/agent_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ func TestAgent_GitSSH(t *testing.T) {
456456

457457
func TestAgent_SessionTTYShell(t *testing.T) {
458458
t.Parallel()
459-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
460-
t.Cleanup(cancel)
461459
if runtime.GOOS == "windows" {
462460
// This might be our implementation, or ConPTY itself.
463461
// It's difficult to find extensive tests for it, so
@@ -468,6 +466,7 @@ func TestAgent_SessionTTYShell(t *testing.T) {
468466
for _, port := range sshPorts {
469467
t.Run(fmt.Sprintf("(%d)", port), func(t *testing.T) {
470468
t.Parallel()
469+
ctx := testutil.Context(t, testutil.WaitShort)
471470

472471
session := setupSSHSessionOnPort(t, agentsdk.Manifest{}, codersdk.ServiceBannerConfig{}, nil, port)
473472
command := "sh"

agent/agentcontainers/containers_dockercli_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ func TestIntegrationDockerCLI(t *testing.T) {
5555
}, testutil.WaitShort, testutil.IntervalSlow, "Container did not start in time")
5656

5757
dcli := agentcontainers.NewDockerCLI(agentexec.DefaultExecer)
58-
ctx := testutil.Context(t, testutil.WaitMedium) // Longer timeout for multiple subtests
5958
containerName := strings.TrimPrefix(ct.Container.Name, "/")
6059

6160
t.Run("DetectArchitecture", func(t *testing.T) {
6261
t.Parallel()
62+
ctx := testutil.Context(t, testutil.WaitShort)
6363

6464
arch, err := dcli.DetectArchitecture(ctx, containerName)
6565
require.NoError(t, err, "DetectArchitecture failed")
@@ -71,6 +71,7 @@ func TestIntegrationDockerCLI(t *testing.T) {
7171

7272
t.Run("Copy", func(t *testing.T) {
7373
t.Parallel()
74+
ctx := testutil.Context(t, testutil.WaitShort)
7475

7576
want := "Help, I'm trapped!"
7677
tempFile := filepath.Join(t.TempDir(), "test-file.txt")
@@ -90,6 +91,7 @@ func TestIntegrationDockerCLI(t *testing.T) {
9091

9192
t.Run("ExecAs", func(t *testing.T) {
9293
t.Parallel()
94+
ctx := testutil.Context(t, testutil.WaitShort)
9395

9496
// Test ExecAs without specifying user (should use container's default).
9597
want := "root"

coderd/telemetry/telemetry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ func TestTelemetryItem(t *testing.T) {
403403

404404
func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
405405
t.Parallel()
406-
ctx := testutil.Context(t, testutil.WaitMedium)
407406
db, _ := dbtestutil.NewDB(t)
408407

409408
cases := []struct {
@@ -435,6 +434,7 @@ func TestPrebuiltWorkspacesTelemetry(t *testing.T) {
435434
for _, tc := range cases {
436435
t.Run(tc.name, func(t *testing.T) {
437436
t.Parallel()
437+
ctx := testutil.Context(t, testutil.WaitShort)
438438

439439
deployment, snapshot := collectSnapshot(ctx, t, db, func(opts telemetry.Options) telemetry.Options {
440440
opts.Database = tc.storeFn(db)

coderd/workspaceapps/db_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ func Test_ResolveRequest(t *testing.T) {
255255
for _, c := range cases {
256256
t.Run(c.name, func(t *testing.T) {
257257
t.Parallel()
258+
ctx := testutil.Context(t, testutil.WaitShort)
258259

259260
// Try resolving a request for each app as the owner, without a
260261
// token, then use the token to resolve each app.
@@ -589,6 +590,7 @@ func Test_ResolveRequest(t *testing.T) {
589590

590591
t.Run("TokenDoesNotMatchRequest", func(t *testing.T) {
591592
t.Parallel()
593+
ctx := testutil.Context(t, testutil.WaitShort)
592594

593595
badToken := workspaceapps.SignedToken{
594596
Request: (workspaceapps.Request{

coderd/workspaces_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,7 @@ func TestWorkspaceFilter(t *testing.T) {
18001800
for _, c := range testCases {
18011801
t.Run(c.Name, func(t *testing.T) {
18021802
t.Parallel()
1803+
ctx := testutil.Context(t, testutil.WaitShort)
18031804
workspaces, err := client.Workspaces(ctx, c.Filter)
18041805
require.NoError(t, err, "fetch workspaces")
18051806

enterprise/coderd/schedule/template_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ func TestTemplateUpdateBuildDeadlines(t *testing.T) {
222222
for _, c := range cases {
223223
t.Run(c.name, func(t *testing.T) {
224224
t.Parallel()
225+
ctx := testutil.Context(t, testutil.WaitShort)
225226

226227
user := quietUser
227228
if c.noQuietHours {

enterprise/wsproxy/wsproxy_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ resourceLoop:
290290

291291
t.Run(r.RegionName, func(t *testing.T) {
292292
t.Parallel()
293+
ctx := testutil.Context(t, testutil.WaitShort)
293294

294295
derpMap := &tailcfg.DERPMap{
295296
Regions: map[int]*tailcfg.DERPRegion{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy