Skip to content

Commit

Permalink
Use t.TempDir instead of os.MkdirTemp
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Jan 2, 2025
1 parent b103c8f commit 9b494ee
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 9b494ee

Please sign in to comment.