Skip to content

Commit

Permalink
Sp consts names + more
Browse files Browse the repository at this point in the history
Signed-off-by: raaizik <[email protected]>
Co-authored-by: Jose A. Rivera <[email protected]>
  • Loading branch information
raaizik and jarrpa committed Jan 29, 2024
1 parent c29859e commit 16328fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ const (
)

var fakeStorageProfile = &v1.StorageProfile{
TypeMeta: metav1.TypeMeta{Kind: storageProfileKind},
ObjectMeta: metav1.ObjectMeta{
Name: "medium",
Namespace: "test-ns",
Namespace: namespaceName,
},
Spec: v1.StorageProfileSpec{
DeviceClass: "ssd",
DeviceClass: deviceClass,
},
}

Expand Down Expand Up @@ -95,13 +96,13 @@ var rejectedStorageProfile = &v1.StorageProfile{
var fakeStorageCluster = &v1.StorageCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "test-storagecluster",
Namespace: "test-ns",
Namespace: namespaceName,
},
Spec: v1.StorageClusterSpec{
DefaultStorageProfile: fakeStorageProfile.Name,
StorageDeviceSets: []v1.StorageDeviceSet{
{
DeviceClass: "ssd",
DeviceClass: deviceClass,
},
},
},
Expand All @@ -113,7 +114,7 @@ var fakeStorageCluster = &v1.StorageCluster{
var fakeStorageConsumer = &v1alpha1.StorageConsumer{
ObjectMeta: metav1.ObjectMeta{
Name: "test-consumer",
Namespace: "test-ns",
Namespace: namespaceName,
},
}

Expand All @@ -126,7 +127,7 @@ var fakeCephFs = &rookCephv1.CephFilesystem{
DataPools: []rookCephv1.NamedPoolSpec{
{
PoolSpec: rookCephv1.PoolSpec{
DeviceClass: "ssd",
DeviceClass: deviceClass,
},
},
},
Expand Down Expand Up @@ -159,7 +160,7 @@ func createFakeReconciler(t *testing.T) StorageClassRequestReconciler {

fakeReconciler.Scheme = createFakeScheme(t)
fakeReconciler.log = log.Log.WithName("controller_storagecluster_test")
fakeReconciler.OperatorNamespace = "test-ns"
fakeReconciler.OperatorNamespace = namespaceName
fakeReconciler.StorageClassRequest = &v1alpha1.StorageClassRequest{}
fakeReconciler.cephResourcesByName = map[string]*v1alpha1.CephResourcesSpec{}

Expand Down
6 changes: 3 additions & 3 deletions controllers/storagecluster/initialization_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func initStorageClusterResourceCreateUpdateTest(t *testing.T, runtimeObjs []clie
if customSpec != nil {
_ = mergo.Merge(&cr.Spec, customSpec)
}
request := reconcile.Request{
requestOCSInit := reconcile.Request{
NamespacedName: types.NamespacedName{
Name: "ocsinit",
Namespace: "",
Expand Down Expand Up @@ -293,13 +293,13 @@ func initStorageClusterResourceCreateUpdateTest(t *testing.T, runtimeObjs []clie

err := os.Setenv("OPERATOR_NAMESPACE", cr.Namespace)
assert.NoError(t, err)
result, err := reconciler.Reconcile(context.TODO(), request)
result, err := reconciler.Reconcile(context.TODO(), requestOCSInit)
assert.NoError(t, err)
assert.Equal(t, reconcile.Result{}, result)
err = os.Setenv("WATCH_NAMESPACE", cr.Namespace)
assert.NoError(t, err)

return t, reconciler, cr, request
return t, reconciler, cr, requestOCSInit
}

func createFakeInitializationStorageClusterReconciler(t *testing.T, obj ...runtime.Object) StorageClusterReconciler {
Expand Down

0 comments on commit 16328fb

Please sign in to comment.