remove object prefix gcs from parameter

This commit is contained in:
ridhozhr 2019-05-27 13:18:08 +07:00
parent e25b36c5e9
commit aa8a29866f
3 changed files with 10 additions and 11 deletions

View File

@ -55,7 +55,8 @@ func CreateComposer() {
stdout.Printf("Using 'gcs://%s' as GCS bucket for storage.\n", Flags.GCSBucket)
store := gcsstore.New(Flags.GCSBucket, Flags.GCSObjectPrefix, service)
store := gcsstore.New(Flags.GCSBucket, service)
store.ObjectPrefix = Flags.GCSObjectPrefix
store.UseIn(Composer)
locker := memorylocker.New()

View File

@ -45,10 +45,9 @@ type GCSStore struct {
// New constructs a new GCS storage backend using the supplied GCS bucket name
// and service object.
func New(bucket string, objPrefix string, service GCSAPI) GCSStore {
func New(bucket string, service GCSAPI) GCSStore {
return GCSStore{
Bucket: bucket,
ObjectPrefix: objPrefix,
Service: service,
}
}

View File

@ -20,7 +20,6 @@ import (
const mockID = "123456789abcdefghijklmnopqrstuvwxyz"
const mockBucket = "bucket"
const mockObjPrefix = ""
const mockSize = 1337
const mockReaderData = "helloworld"
@ -44,7 +43,7 @@ func TestNewUpload(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)
@ -95,7 +94,7 @@ func TestGetInfo(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)
@ -158,7 +157,7 @@ func TestGetInfoNotFound(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
params := gcsstore.GCSObjectParams{
Bucket: store.Bucket,
@ -203,7 +202,7 @@ func TestGetReader(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)
@ -232,7 +231,7 @@ func TestTerminate(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)
@ -254,7 +253,7 @@ func TestFinishUpload(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)
@ -373,7 +372,7 @@ func TestWriteChunk(t *testing.T) {
assert := assert.New(t)
service := NewMockGCSAPI(mockCtrl)
store := gcsstore.New(mockBucket, mockObjPrefix, service)
store := gcsstore.New(mockBucket, service)
assert.Equal(store.Bucket, mockBucket)