From 098aa0a0c001335efec3f8fc1122398da2ac8f6a Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Wed, 15 Jan 2020 16:10:25 +0800 Subject: [PATCH] Fix: failed unit test due to setting name change --- .travis.yml | 2 +- pkg/filesystem/filesystem.go | 10 ++++++---- pkg/filesystem/remote/handler_test.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81b7262..8773ab4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ go: git: depth: 1 script: - - go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... + - go test -race -coverprofile=coverage.txt -covermode=atomic ./... after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/pkg/filesystem/filesystem.go b/pkg/filesystem/filesystem.go index 3184711..83d5e81 100644 --- a/pkg/filesystem/filesystem.go +++ b/pkg/filesystem/filesystem.go @@ -36,16 +36,18 @@ type FileHeader interface { // Handler 存储策略适配器 type Handler interface { - // 上传文件 + // 上传文件, dst为文件存储路径,size 为文件大小。上下文关闭 + // 时,应取消上传并清理临时文件 Put(ctx context.Context, file io.ReadCloser, dst string, size uint64) error - // 删除一个或多个文件 + // 删除一个或多个给定路径的文件,返回删除失败的文件路径列表及错误 Delete(ctx context.Context, files []string) ([]string, error) - // 获取文件 + // 获取文件内容 Get(ctx context.Context, path string) (response.RSCloser, error) - // 获取缩略图 + // 获取缩略图,可直接在ContentResponse中返回文件数据流,也可指 + // 定为重定向 Thumb(ctx context.Context, path string) (*response.ContentResponse, error) // 获取外链/下载地址, diff --git a/pkg/filesystem/remote/handler_test.go b/pkg/filesystem/remote/handler_test.go index 75402c6..a850c95 100644 --- a/pkg/filesystem/remote/handler_test.go +++ b/pkg/filesystem/remote/handler_test.go @@ -347,7 +347,7 @@ func TestHandler_Thumb(t *testing.T) { AuthInstance: auth.HMACAuth{}, } ctx := context.Background() - asserts.NoError(cache.Set("preview_timeout", "60", 0)) + asserts.NoError(cache.Set("setting_preview_timeout", "60", 0)) resp, err := handler.Thumb(ctx, "/1.txt") asserts.NoError(err) asserts.True(resp.Redirect)