chore: avoid concurrent usage of t.FailNow (#1683)

* chore: golangci: add linter rule to report usage of t.FailNow inside goroutines
* chore: avoid t.FailNow in goroutines to appease the race detector
This commit is contained in:
Cian Johnston
2022-05-24 08:58:39 +01:00
committed by GitHub
parent 9b70a9b2eb
commit c2f74f3cc2
27 changed files with 120 additions and 74 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/provisioner/echo"
@@ -31,7 +32,7 @@ func TestEcho(t *testing.T) {
err := echo.Serve(ctx, &provisionersdk.ServeOptions{
Listener: server,
})
require.NoError(t, err)
assert.NoError(t, err)
}()
api := proto.NewDRPCProvisionerClient(provisionersdk.Conn(client))
+2 -1
View File
@@ -9,6 +9,7 @@ import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/coder/coder/provisioner/terraform"
@@ -33,7 +34,7 @@ func TestParse(t *testing.T) {
Listener: server,
},
})
require.NoError(t, err)
assert.NoError(t, err)
}()
api := proto.NewDRPCProvisionerClient(provisionersdk.Conn(client))
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"cdr.dev/slog"
@@ -53,7 +54,7 @@ provider "coder" {
},
Logger: slogtest.Make(t, nil).Leveled(slog.LevelDebug),
})
require.NoError(t, err)
assert.NoError(t, err)
}()
api := proto.NewDRPCProvisionerClient(provisionersdk.Conn(client))