Skip to content

Deflake windows tests #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 15, 2021
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ jobs:
- name: Platform Tests
run: |
cd platform-test
go test -v ./...
go test -v -race ./...
16 changes: 8 additions & 8 deletions platform-test/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"database/sql"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"testing"

Expand All @@ -21,15 +19,19 @@ func Test_AllMajorVersions(t *testing.T) {
embeddedpostgres.V10,
embeddedpostgres.V9,
}
tempExtractLocation, err := ioutil.TempDir("", "embedded_postgres_go_tests")

tempExtractLocation, err := ioutil.TempDir("", "embedded_postgres_tests")
if err != nil {
t.Fatal(err)
}

for testNumber, version := range allVersions {
for i, v := range allVersions {
testNumber := i
version := v
t.Run(fmt.Sprintf("MajorVersion_%s", version), func(t *testing.T) {
port := uint32(5555 + testNumber)
runtimePath := filepath.Join(tempExtractLocation, strconv.Itoa(testNumber))
runtimePath := filepath.Join(tempExtractLocation, string(version))

database := embeddedpostgres.NewDatabase(embeddedpostgres.DefaultConfig().
Version(version).
Port(port).
Expand Down Expand Up @@ -65,15 +67,13 @@ func Test_AllMajorVersions(t *testing.T) {
}
})
}
if err := os.RemoveAll(tempExtractLocation); err != nil {
t.Fatal(err)
}
}

func shutdownDBAndFail(t *testing.T, err error, db *embeddedpostgres.EmbeddedPostgres, version embeddedpostgres.PostgresVersion) {
if err := db.Stop(); err != nil {
t.Fatalf("Failed for version %s with error %s", version, err)
}

t.Fatalf("Failed for version %s with error %s", version, err)
}

Expand Down