Skip to content

Commit

Permalink
fix tests for get file
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Nov 23, 2023
1 parent b89b535 commit bbbc73c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions zipserver/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"io/fs"
"math/rand"
"net/http"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -94,7 +95,7 @@ func (zl *zipLayout) Check(t *testing.T, storage *MemStorage, bucket, prefix str
}

path := fmt.Sprintf("%s/%s", prefix, name)
reader, err := storage.GetFile(ctx, bucket, path)
reader, _, err := storage.GetFile(ctx, bucket, path)
if entry.ignored {
assert.Error(t, err)
assert.True(t, strings.Contains(err.Error(), "object not found"))
Expand Down Expand Up @@ -413,8 +414,8 @@ type mockFailingStorage struct {
path string
}

func (m *mockFailingStorage) GetFile(_ context.Context, _, _ string) (io.ReadCloser, error) {
return &mockFailingReadCloser{m.t, m.path}, nil
func (m *mockFailingStorage) GetFile(_ context.Context, _, _ string) (io.ReadCloser, http.Header, error) {
return &mockFailingReadCloser{m.t, m.path}, nil, nil
}

func (m *mockFailingStorage) PutFile(_ context.Context, _, _ string, contents io.Reader, _ string) error {
Expand Down
2 changes: 1 addition & 1 deletion zipserver/gcs_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestGetFile(t *testing.T) {
ctx := context.Background()

withGoogleCloudStorage(t, func(storage Storage, config *Config) {
reader, err := storage.GetFile(ctx, config.Bucket, "text.txt")
reader, _, err := storage.GetFile(ctx, config.Bucket, "text.txt")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit bbbc73c

Please sign in to comment.