Outdated index files from previous builds break tests. Use t.TempDir() to make sure a new index file is used. diff --git a/integration_test/testutil_test.go b/integration_test/testutil_test.go index 66ebc98..d91635b 100644 --- a/integration_test/testutil_test.go +++ b/integration_test/testutil_test.go @@ -277,7 +277,7 @@ func (it *ITest) loadReceipt(path string) index.Receipt { // It caches the index tree as in-memory tar after the first run. func (it *ITest) initializeIndex() { initIndexOnce.Do(func() { - persistentCacheFile := filepath.Join(os.TempDir(), persistentIndexCache) + persistentCacheFile := filepath.Join(it.t.TempDir(), persistentIndexCache) fileInfo, err := os.Stat(persistentCacheFile) if err == nil && fileInfo.Mode().IsRegular() {