@@ -36,7 +36,7 @@ func withDefaultAffected(id string) database.OSV {
3636
3737func withSummary (id string , summary string ) database.OSV {
3838 return database.OSV {
39- ID : id ,
39+ ID : id ,
4040 Summary : summary ,
4141 Affected : []database.Affected {
4242 {
@@ -157,7 +157,7 @@ func TestNewZippedDB_Offline_WithoutCache(t *testing.T) {
157157 t .Errorf ("a server request was made when running offline" )
158158 })
159159
160- _ , err := database .NewZippedDB (database.Config {URL : ts .URL }, true )
160+ _ , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, true )
161161
162162 if ! errors .Is (err , database .ErrOfflineDatabaseNotFound ) {
163163 t .Errorf ("expected \" %v\" error but got \" %v\" " , database .ErrOfflineDatabaseNotFound , err )
@@ -193,7 +193,7 @@ func TestNewZippedDB_Offline_WithCache(t *testing.T) {
193193 }),
194194 })
195195
196- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, true )
196+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, true )
197197
198198 if err != nil {
199199 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -213,7 +213,7 @@ func TestNewZippedDB_BadZip(t *testing.T) {
213213 _ , _ = w .Write ([]byte ("this is not a zip" ))
214214 })
215215
216- _ , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
216+ _ , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
217217
218218 if err == nil {
219219 t .Errorf ("expected an error but did not get one" )
@@ -223,7 +223,7 @@ func TestNewZippedDB_BadZip(t *testing.T) {
223223func TestNewZippedDB_UnsupportedProtocol (t * testing.T ) {
224224 t .Parallel ()
225225
226- _ , err := database .NewZippedDB (database.Config {URL : "file://hello-world" }, false )
226+ _ , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : "file://hello-world" }, false )
227227
228228 if err == nil {
229229 t .Errorf ("expected an error but did not get one" )
@@ -251,7 +251,7 @@ func TestNewZippedDB_Online_WithoutCache(t *testing.T) {
251251 }))
252252 })
253253
254- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
254+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
255255
256256 if err != nil {
257257 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -268,7 +268,7 @@ func TestNewZippedDB_Online_WithoutCache_NotFound(t *testing.T) {
268268 _ , _ = w .Write (zipOSVs (t , map [string ]database.OSV {}))
269269 })
270270
271- _ , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
271+ _ , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
272272
273273 if err == nil {
274274 t .Errorf ("expected an error but did not get one" )
@@ -306,7 +306,7 @@ func TestNewZippedDB_Online_WithCache(t *testing.T) {
306306 }),
307307 })
308308
309- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
309+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
310310
311311 if err != nil {
312312 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -357,7 +357,7 @@ func TestNewZippedDB_Online_WithOldCache(t *testing.T) {
357357 }),
358358 })
359359
360- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
360+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
361361
362362 if err != nil {
363363 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -389,7 +389,7 @@ func TestNewZippedDB_Online_WithBadCache(t *testing.T) {
389389
390390 cacheWriteBad (t , ts .URL , "this is not json!" )
391391
392- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
392+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
393393
394394 if err != nil {
395395 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -413,7 +413,7 @@ func TestNewZippedDB_FileChecks(t *testing.T) {
413413 }))
414414 })
415415
416- db , err := database .NewZippedDB (database.Config {URL : ts .URL }, false )
416+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL }, false )
417417
418418 if err != nil {
419419 t .Fatalf ("unexpected error \" %v\" " , err )
@@ -435,7 +435,7 @@ func TestNewZippedDB_WorkingDirectory(t *testing.T) {
435435 }))
436436 })
437437
438- db , err := database .NewZippedDB (database.Config {URL : ts .URL , WorkingDirectory : "reviewed" }, false )
438+ db , err := database .NewZippedDB (database.Config {CacheDirectory : os . TempDir (), URL : ts .URL , WorkingDirectory : "reviewed" }, false )
439439
440440 if err != nil {
441441 t .Fatalf ("unexpected error \" %v\" " , err )
0 commit comments