diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-08-01 14:49:15 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-08-01 14:49:49 +0200 |
| commit | 6d72c85766a8355e1d660ff0c19b43e93faad4d8 (patch) | |
| tree | 118c3cbdf43a9d4355ece98ea70bd184630b4e1c /pgruntime/testdb.go | |
| parent | e26a214de3958e48e94cdac0e1ae0641e3221deb (diff) | |
| download | go-gg-6d72c85766a8355e1d660ff0c19b43e93faad4d8.tar.gz | |
add testing/pgruntime
Testing pgruntime has quickly turned out to be a nightmare, because so
many parts of the test logic are not easily reproducible (e.g.
`stopDBIfLingering`). I decided to not waste a bunch of time testing
code that is relatively compact and easy to verify by careful
examination, and that is unlikely to change a lot in the future.
Diffstat (limited to 'pgruntime/testdb.go')
| -rw-r--r-- | pgruntime/testdb.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pgruntime/testdb.go b/pgruntime/testdb.go index 261f88a..808784c 100644 --- a/pgruntime/testdb.go +++ b/pgruntime/testdb.go @@ -69,8 +69,7 @@ func WithTestDB(m *testing.M, action func() int) int { if err == nil { return result } else { - fmt.Fprintln(os.Stderr, err.Error()) - return 1 + panic(err.Error()) } } @@ -135,7 +134,12 @@ func findTestdbPath() (string, error) { // if there is an override path, report the override path (so that initDBIfNecessary can create it), // but put a symlink at the standard path for convenient access - return overridePath, os.Symlink(overridePath, testdbPath) + err = os.Symlink(overridePath, testdbPath) + if os.IsExist(err) { + // do not complain if the symlink already exists + err = nil + } + return overridePath, err } func findModuleRootDir(dirPath string) (Option[string], error) { |
