Skip to content

Commit

Permalink
small update
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBisson committed Dec 5, 2024
1 parent 8be2cde commit 6ec3ad5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 53 deletions.
1 change: 0 additions & 1 deletion internal/controller/bucket_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func (r BucketReconciler) reconcileNormal(ctx context.Context, objectStorageServ
logger.Error(err, "Bucket could not be updated")
return ctrl.Result{}, errors.WithStack(err)
}
logger.Info("Bucket exists and you already own it.")
}

logger.Info("Configuring bucket settings")
Expand Down
52 changes: 0 additions & 52 deletions internal/pkg/service/objectstorage/cloud/azure/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,55 +42,3 @@ func Test_sanitizeStorageAccountName(t *testing.T) {
})
}
}

func Test_getStorageAccountName(t *testing.T) {
testCases := []struct {
name string
bucketName string
listStorageNames []string
expectedResult string
expectedListNames []string
}{
{
name: "case 0: bucket name exists in list",
bucketName: "giantswarm-glippy-loki",
listStorageNames: []string{"giantswarmglippyloki", "giantswarmverylonginstal"},
expectedResult: "giantswarmglippyloki",
expectedListNames: []string{"giantswarmglippyloki", "giantswarmverylonginstal"},
},
{
name: "case 1: bucket name does not exist in list",
bucketName: "giantswarm-verylonginstallationname-loki",
listStorageNames: []string{"giantswarmglippyloki"},
expectedResult: "giantswarmverylonginstal",
expectedListNames: []string{"giantswarmglippyloki", "giantswarmverylonginstal"},
},
{
name: "case 2: empty list",
bucketName: "giantswarm-1111-loki",
listStorageNames: []string{},
expectedResult: "giantswarm1111loki",
expectedListNames: []string{"giantswarm1111loki"},
},
}

for i, tc := range testCases {
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Log(tc.name)

adapter := &AzureObjectStorageAdapter{
listStorageAccountName: tc.listStorageNames,
}

result := sanitizeStorageAccountName(tc.bucketName)

if result != tc.expectedResult {
t.Fatalf("Expected result: %s, but got: %s", tc.expectedResult, result)
}

if !cmp.Equal(adapter.listStorageAccountName, tc.expectedListNames) {
t.Fatalf("\n\n%s\n", cmp.Diff(tc.expectedListNames, adapter.listStorageAccountName))
}
})
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ec3ad5

Please sign in to comment.