Skip to content

Commit

Permalink
Merge pull request #353 from maxmind/greg/use-t-tempdir
Browse files Browse the repository at this point in the history
Use t.TempDir instead of os.MkdirTemp
  • Loading branch information
horgh authored Jan 2, 2025
2 parents b103c8f + 9b494ee commit 8893c55
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cmd/geoipupdate/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ import (

func TestUpdater(t *testing.T) {
// mock existing databases.
tempDir, err := os.MkdirTemp("", "db")
require.NoError(t, err)
defer os.RemoveAll(tempDir)
tempDir := t.TempDir()

edition := "edition-1"
dbFile := filepath.Join(tempDir, edition+".mmdb")
// equivalent MD5: 618dd27a10de24809ec160d6807f363f
err = os.WriteFile(dbFile, []byte("edition-1 content"), os.ModePerm)
err := os.WriteFile(dbFile, []byte("edition-1 content"), os.ModePerm)
require.NoError(t, err)

edition = "edition-2"
Expand Down

0 comments on commit 8893c55

Please sign in to comment.