Skip to content

Commit 05b3cc2

Browse files
Deflake windows tests (#39)
* Deflaking the windows tests
1 parent c53d7f3 commit 05b3cc2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ jobs:
8383
- name: Platform Tests
8484
run: |
8585
cd platform-test
86-
go test -v ./...
86+
go test -v -race ./...

platform-test/platform_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import (
44
"database/sql"
55
"fmt"
66
"io/ioutil"
7-
"os"
87
"path/filepath"
9-
"strconv"
108
"strings"
119
"testing"
1210

@@ -21,15 +19,19 @@ func Test_AllMajorVersions(t *testing.T) {
2119
embeddedpostgres.V10,
2220
embeddedpostgres.V9,
2321
}
24-
tempExtractLocation, err := ioutil.TempDir("", "embedded_postgres_go_tests")
22+
23+
tempExtractLocation, err := ioutil.TempDir("", "embedded_postgres_tests")
2524
if err != nil {
2625
t.Fatal(err)
2726
}
2827

29-
for testNumber, version := range allVersions {
28+
for i, v := range allVersions {
29+
testNumber := i
30+
version := v
3031
t.Run(fmt.Sprintf("MajorVersion_%s", version), func(t *testing.T) {
3132
port := uint32(5555 + testNumber)
32-
runtimePath := filepath.Join(tempExtractLocation, strconv.Itoa(testNumber))
33+
runtimePath := filepath.Join(tempExtractLocation, string(version))
34+
3335
database := embeddedpostgres.NewDatabase(embeddedpostgres.DefaultConfig().
3436
Version(version).
3537
Port(port).
@@ -65,15 +67,13 @@ func Test_AllMajorVersions(t *testing.T) {
6567
}
6668
})
6769
}
68-
if err := os.RemoveAll(tempExtractLocation); err != nil {
69-
t.Fatal(err)
70-
}
7170
}
7271

7372
func shutdownDBAndFail(t *testing.T, err error, db *embeddedpostgres.EmbeddedPostgres, version embeddedpostgres.PostgresVersion) {
7473
if err := db.Stop(); err != nil {
7574
t.Fatalf("Failed for version %s with error %s", version, err)
7675
}
76+
7777
t.Fatalf("Failed for version %s with error %s", version, err)
7878
}
7979

0 commit comments

Comments
 (0)