Skip to content

Commit

Permalink
Add conversion from s3Compliant type to s3 type (#1883)
Browse files Browse the repository at this point in the history
* Add conversion from s3Compliant type to s3 type

* Add test for s3Compliant case

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ankitjain235 and mergify[bot] committed Mar 13, 2023
1 parent eb00fe1 commit b319c70
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kopia/command/storage/secret_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"

"github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/kanisterio/kanister/pkg/aws"
"github.com/kanisterio/kanister/pkg/secrets"
)
Expand Down Expand Up @@ -183,6 +184,9 @@ func GetMapForLocationValues(
}
if locType != "" {
m[typeKey] = []byte(locType)
if locType == LocType(v1alpha1.LocationTypeS3Compliant) {
m[typeKey] = []byte(LocTypeS3)
}
}
return m
}
17 changes: 17 additions & 0 deletions pkg/kopia/command/storage/secret_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1"
"github.com/kanisterio/kanister/pkg/aws"
"github.com/kanisterio/kanister/pkg/secrets"
)
Expand Down Expand Up @@ -268,6 +269,22 @@ func (s *StorageUtilsSuite) TestGetMapForLocationValues(c *check.C) {
skipSSLVerifyKey: []byte(skipSSLVerifyValue),
},
},
{
locType: LocType(v1alpha1.LocationTypeS3Compliant),
prefix: prefixValue,
region: regionValue,
bucket: bucketValue,
endpoint: endpointValue,
skipSSLVerify: skipSSLVerifyValue,
expectedOutput: map[string][]byte{
typeKey: []byte(LocTypeS3),
prefixKey: []byte(prefixValue),
regionKey: []byte(regionValue),
bucketKey: []byte(bucketValue),
endpointKey: []byte(endpointValue),
skipSSLVerifyKey: []byte(skipSSLVerifyValue),
},
},
} {
op := GetMapForLocationValues(
tc.locType,
Expand Down

0 comments on commit b319c70

Please sign in to comment.