Skip to content

Commit

Permalink
Merge pull request #10 from datadrivers/v0.6.1
Browse files Browse the repository at this point in the history
v0.6.1
  • Loading branch information
Nosmoht authored Mar 31, 2020
2 parents eb3c803 + 530f40d commit 28e363c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
8 changes: 3 additions & 5 deletions blobstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,11 @@ func (c client) BlobstoreRead(id string) (*Blobstore, error) {
return nil, err
}

bsDetailed.Name = bs.Name
bsDetailed.Type = bs.Type
bsDetailed.AvailableSpaceInBytes = bs.AvailableSpaceInBytes
bsDetailed.BlobCount = bs.BlobCount
bsDetailed.Name = bs.Name
bsDetailed.TotalSizeInBytes = bs.TotalSizeInBytes
bsDetailed.AvailableSpaceInBytes = bs.AvailableSpaceInBytes

bs.Name = bsDetailed.Name
bsDetailed.Type = bs.Type

return bsDetailed, nil
}
Expand Down
15 changes: 9 additions & 6 deletions blobstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestBlobstoreRead(t *testing.T) {

if bs != nil {
assert.Equal(t, bsName, bs.Name)
assert.NotEqual(t, "", bs.Path)
}
}

Expand Down Expand Up @@ -89,11 +90,13 @@ func TestBlobstoreS3(t *testing.T) {
s3BS, err := client.BlobstoreRead(bs.Name)
assert.Nil(t, err)
assert.NotNil(t, s3BS)
assert.Equal(t, BlobstoreTypeS3, s3BS.Type)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration.BlobstoreS3Bucket)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration.BlobstoreS3BucketSecurity)
if s3BS != nil {
assert.Equal(t, BlobstoreTypeS3, s3BS.Type)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration.BlobstoreS3Bucket)
assert.NotNil(t, s3BS.BlobstoreS3BucketConfiguration.BlobstoreS3BucketSecurity)

err = client.BlobstoreDelete(bs.Name)
assert.Nil(t, err)
err = client.BlobstoreDelete(bs.Name)
assert.Nil(t, err)
}
}
6 changes: 3 additions & 3 deletions repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ type RepositoryProxy struct {

// RepositoryStorage contains repository storage
type RepositoryStorage struct {
BlobStoreName string `json:"blobStoreName"`
StrictContentTypeValidation bool `json:"strictContentTypeValidation"`
WritePolicy *string `json:"writePolicy,omitempty"`
BlobStoreName string `json:"blobStoreName"`
StrictContentTypeValidation bool `json:"strictContentTypeValidation"`
WritePolicy string `json:"writePolicy,omitempty"`
}

func jsonUnmarshalRepositories(data []byte) ([]Repository, error) {
Expand Down
12 changes: 4 additions & 8 deletions repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ func testJSONUnmarshalRepositories() string {
}

func getTestRepositoryAptHosted(name string) Repository {
writePolicy := "ALLOW_ONCE"

return Repository{
Name: name,
Online: true,
Expand All @@ -103,7 +101,7 @@ func getTestRepositoryAptHosted(name string) Repository {
RepositoryStorage: &RepositoryStorage{
BlobStoreName: "default",
StrictContentTypeValidation: true,
WritePolicy: &writePolicy,
WritePolicy: "ALLOW",
},
}
}
Expand All @@ -130,7 +128,7 @@ func getTestRepositoryDockerHostedWithPorts(name string) Repository {
httpsPort := new(int)
*httpPort = 8082
*httpsPort = 8083
writePolicy := "ALLOW_ONCE"
writePolicy := "ALLOW"

return Repository{
Name: name,
Expand All @@ -149,7 +147,7 @@ func getTestRepositoryDockerHostedWithPorts(name string) Repository {
RepositoryStorage: &RepositoryStorage{
BlobStoreName: "default",
StrictContentTypeValidation: true,
WritePolicy: &writePolicy,
WritePolicy: writePolicy,
},
}
}
Expand All @@ -172,8 +170,6 @@ func TestRepositoryDockerHostedWithPorts(t *testing.T) {
}

func getTestRepositoryDockerHostedWithoutPorts(name string) Repository {
writePolicy := "ALLOW_ONCE"

return Repository{
Name: name,
Online: true,
Expand All @@ -189,7 +185,7 @@ func getTestRepositoryDockerHostedWithoutPorts(name string) Repository {
RepositoryStorage: &RepositoryStorage{
BlobStoreName: "default",
StrictContentTypeValidation: true,
WritePolicy: &writePolicy,
WritePolicy: "ALLOW_ONCE",
},
}
}
Expand Down

0 comments on commit 28e363c

Please sign in to comment.