Skip to content

Commit

Permalink
Fixed tests that failed on Alpine.
Browse files Browse the repository at this point in the history
  • Loading branch information
mishas committed Sep 15, 2021
1 parent bbb37e6 commit c5ec246
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions embedded_postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,26 +465,37 @@ func Test_CustomBinariesLocation(t *testing.T) {
}

func Test_PrefetchedBinaries(t *testing.T) {
tempDir, err := ioutil.TempDir("", "prepare_database_test")
binTempDir, err := ioutil.TempDir("", "prepare_database_test_bin")
if err != nil {
panic(err)
}

runtimeTempDir, err := ioutil.TempDir("", "prepare_database_test_runtime")
if err != nil {
panic(err)
}

defer func() {
if err := os.RemoveAll(tempDir); err != nil {
if err := os.RemoveAll(binTempDir); err != nil {
panic(err)
}

if err := os.RemoveAll(runtimeTempDir); err != nil {
panic(err)
}
}()

database := NewDatabase(DefaultConfig().BinariesPath(tempDir))
database := NewDatabase(DefaultConfig().
BinariesPath(binTempDir).
RuntimePath(runtimeTempDir))

// Download and unarchive postgres into the bindir.
if err := database.remoteFetchStrategy(); err != nil {
panic(err)
}

cacheLocation, _ := database.cacheLocator()
if err := archiver.NewTarXz().Unarchive(cacheLocation, tempDir); err != nil {
if err := archiver.NewTarXz().Unarchive(cacheLocation, binTempDir); err != nil {
panic(err)
}

Expand Down

0 comments on commit c5ec246

Please sign in to comment.