Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8a8f9d

Browse files
authored
chore: skip some flaky tests (#1643)
* chore: skip some flaky tests * Update peer/conn_test.go * add makefile targets, reduce parallelism in go test
1 parent 4f75291 commit a8a8f9d

File tree

6 files changed

+36
-7
lines changed

6 files changed

+36
-7
lines changed

.github/workflows/coder.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,7 @@ jobs:
275275
done
276276
277277
- name: Test with PostgreSQL Database
278-
run: DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --
279-
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
280-
-coverpkg=./...,github.com/coder/coder/codersdk
281-
-count=1 -parallel=2 -race -failfast
278+
run: "make test-postgres"
282279

283280
- name: Upload DataDog Trace
284281
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork

Makefile

+29-1
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,33 @@ site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk
9191
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
9292
cd site && yarn run format:types
9393

94-
test:
94+
.PHONY: test
95+
test: test-clean
9596
gotestsum -- -v -short ./...
97+
98+
.PHONY: test-postgres
99+
test-postgres: test-clean
100+
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." -- \
101+
-covermode=atomic -coverprofile="gotests.coverage" -timeout=5m \
102+
-coverpkg=./...,github.com/coder/coder/codersdk \
103+
-count=1 -parallel=1 -race -failfast
104+
105+
106+
.PHONY: test-postgres-docker
107+
test-postgres-docker:
108+
docker run \
109+
--env POSTGRES_PASSWORD=postgres \
110+
--env POSTGRES_USER=postgres \
111+
--env POSTGRES_DB=postgres \
112+
--env PGDATA=/tmp \
113+
--publish 5432:5432 \
114+
--name test-postgres-docker \
115+
--restart unless-stopped \
116+
--detach \
117+
postgres:11 \
118+
-c shared_buffers=1GB \
119+
-c max_connections=1000
120+
121+
.PHONY: test-clean
122+
test-clean:
123+
go clean -testcache

cli/parameter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import (
66
"golang.org/x/xerrors"
77
"gopkg.in/yaml.v3"
88

9+
"github.com/spf13/cobra"
10+
911
"github.com/coder/coder/cli/cliui"
1012
"github.com/coder/coder/codersdk"
11-
"github.com/spf13/cobra"
1213
)
1314

1415
// Reads a YAML file and populates a string -> string map.

cli/ssh_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
)
2424

2525
func TestSSH(t *testing.T) {
26+
t.Skip("This is causing test flakes. TODO @cian fix this")
2627
t.Parallel()
2728
t.Run("ImmediateExit", func(t *testing.T) {
2829
t.Parallel()

coderd/workspaces_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ func TestWorkspacesByOrganization(t *testing.T) {
182182
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, nil)
183183
coderdtest.AwaitTemplateVersionJob(t, client, version.ID)
184184
template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
185-
_ = coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
185+
ws := coderdtest.CreateWorkspace(t, client, user.OrganizationID, template.ID)
186+
_ = coderdtest.AwaitWorkspaceBuildJob(t, client, ws.LatestBuild.ID)
186187
workspaces, err := client.WorkspacesByOrganization(context.Background(), user.OrganizationID)
187188
require.NoError(t, err)
188189
require.Len(t, workspaces, 1)

peer/conn_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func TestMain(m *testing.M) {
5959
}
6060

6161
func TestConn(t *testing.T) {
62+
t.Skip("known flake -- https://github.com/coder/coder/issues/1644")
6263
t.Parallel()
6364

6465
t.Run("Ping", func(t *testing.T) {

0 commit comments

Comments
 (0)