Skip to content

Commit

Permalink
rename conflicting env variables with s3compliant prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
kale-amruta committed Jul 11, 2023
1 parent 590ea8c commit 7a05062
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions build/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ check_dependencies() {
# Check if minio is already deployed
if helm status minio -n minio > /dev/null 2>&1 ; then
# Setting env vars to access MinIO
export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
export AWS_REGION="us-west-2"
export LOCATION_ENDPOINT="http://minio.minio.svc.cluster.local:9000"
export S3_COMPLIANT_AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export S3_COMPLIANT_AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
export S3_COMPLIANT_AWS_REGION="us-west-2"
export S3_COMPLIANT_LOCATION_ENDPOINT="http://minio.minio.svc.cluster.local:9000"
else
echo "Please install MinIO using 'make install-minio' and try again."
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ func (s *RepoServerControllerSuite) SetUpSuite(c *C) {

s.repoServerControllerNamespace = cns.Name

os.Setenv("POD_NAMESPACE", s.repoServerControllerNamespace)

// Since we are not creating the controller in a pod
// the repository server controller needs few env variables set explicitly
os.Setenv("POD_NAMESPACE", s.repoServerControllerNamespace)
mgr, err := ctrl.NewManager(config, ctrl.Options{
Scheme: scheme,
Port: 9443,
Expand Down Expand Up @@ -359,7 +360,7 @@ func (s *RepoServerControllerSuite) TestInvalidRepositoryPassword(c *C) {
}

func (s *RepoServerControllerSuite) waitForRepoServerInfoUpdateInCR(repoServerName string) error {
ctxTimeout := 1 * time.Minute
ctxTimeout := 25 * time.Minute
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
defer cancel()
err := poll.Wait(ctx, func(ctx context.Context) (bool, error) {
Expand All @@ -379,7 +380,7 @@ func (s *RepoServerControllerSuite) waitForRepoServerInfoUpdateInCR(repoServerNa
}

func (s *RepoServerControllerSuite) waitOnRepositoryServerState(c *C, reposerverName string) error {
ctxTimeout := 10 * time.Minute
ctxTimeout := 15 * time.Minute
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
defer cancel()
err := poll.Wait(ctx, func(ctx context.Context) (bool, error) {
Expand Down
11 changes: 7 additions & 4 deletions pkg/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ import (
)

const (
testBPArg = "key"
testBPArg = "key"
s3CompliantAccessKeyIDEnv = "S3_COMPLIANT_AWS_ACCESS_KEY_ID"
s3CompliantSecretAccessKeyEnv = "S3_COMPLIANT_AWS_SECRET_ACCESS_KEY"
s3CompliantLocationEndpointEnv = "S3_COMPLIANT_LOCATION_ENDPOINT"
)

// NewTestPVC function returns a pointer to a new PVC test object
Expand Down Expand Up @@ -446,8 +449,8 @@ func GetKopiaTLSSecretData() (map[string][]byte, error) {
}

func GetDefaultS3StorageCreds() map[string][]byte {
key := os.Getenv(awsconfig.AccessKeyID)
val := os.Getenv(awsconfig.SecretAccessKey)
key := os.Getenv(s3CompliantAccessKeyIDEnv)
val := os.Getenv(s3CompliantSecretAccessKeyEnv)

return map[string][]byte{
secrets.AWSAccessKeyID: []byte(key),
Expand All @@ -461,7 +464,7 @@ func GetDefaultS3CompliantStorageLocation() map[string][]byte {
reposerver.BucketKey: []byte(TestS3BucketName),
reposerver.PrefixKey: []byte(KopiaRepositoryPath),
reposerver.RegionKey: []byte(TestS3Region),
reposerver.EndpointKey: []byte(os.Getenv("LOCATION_ENDPOINT")),
reposerver.EndpointKey: []byte(os.Getenv(s3CompliantLocationEndpointEnv)),
}
}

Expand Down

0 comments on commit 7a05062

Please sign in to comment.