@@ -27,19 +27,16 @@ func TestGetObjectErrors(t *testing.T) {
2727 tests := []struct {
2828 description string
2929 identifier string
30- expectFile bool
3130 expectedErr error
3231 }{
3332 {
3433 description : "identifier does not exist" ,
3534 identifier : "test-cache-get-not-exists" ,
36- expectFile : false ,
3735 expectedErr : os .ErrNotExist ,
3836 },
3937 {
4038 description : "identifier is invalid" ,
4139 identifier : "in../../valid" ,
42- expectFile : false ,
4340 expectedErr : ErrorInvalidCacheIdentifier ,
4441 },
4542 }
@@ -48,28 +45,15 @@ func TestGetObjectErrors(t *testing.T) {
4845 t .Run (tt .description , func (t * testing.T ) {
4946 id := tt .identifier + "-" + uuid .NewString ()
5047
51- // setup
52- if tt .expectFile {
53- path := filepath .Join (cacheFolderPath , id )
54- if err := os .WriteFile (path , []byte ("dummy" ), 0o600 ); err != nil {
55- t .Fatalf ("setup: WriteFile (%s) failed" , path )
56- }
57- }
5848 // test
5949 file , err := GetObject (id )
6050
6151 if ! errors .Is (err , tt .expectedErr ) {
6252 t .Fatalf ("returned error (%q) does not match %q" , err .Error (), tt .expectedErr .Error ())
6353 }
6454
65- if tt .expectFile {
66- if len (file ) < 1 {
67- t .Fatalf ("expected a file but byte array is empty (len %d)" , len (file ))
68- }
69- } else {
70- if len (file ) > 0 {
71- t .Fatalf ("didn't expect a file, but byte array is not empty (len %d)" , len (file ))
72- }
55+ if len (file ) > 0 {
56+ t .Fatalf ("didn't expect a file, but byte array is not empty (len %d)" , len (file ))
7357 }
7458 })
7559 }
0 commit comments