Skip to content

Commit

Permalink
e2e test failure fix
Browse files Browse the repository at this point in the history
Signed-off-by: raaizik <[email protected]>
  • Loading branch information
raaizik committed May 15, 2024
1 parent c84dd9e commit 4040225
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
12 changes: 4 additions & 8 deletions controllers/storagecluster/initialization_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,17 @@ func createFakeInitializationStorageClusterReconciler(t *testing.T, obj ...runti
Phase: cephv1.ConditionType(util.PhaseReady),
},
}
verOdf, err := semver.Make(getSemVer(ocsversion.Version, 1, true))
verOcs, err := semver.Make(getSemVer(ocsversion.Version, 1, true))
if err != nil {
verOdf = semver.Version{
Major: 0,
Minor: 0,
Patch: 0,
}
panic(err)
}
csv := &opv1a1.ClusterServiceVersion{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("odf-operator-%s", sc.Name),
Name: fmt.Sprintf("ocs-operator-%s", sc.Name),
Namespace: sc.Namespace,
},
Spec: opv1a1.ClusterServiceVersionSpec{
Version: oprverion.OperatorVersion{Version: verOdf},
Version: oprverion.OperatorVersion{Version: verOcs},
},
}

Expand Down
12 changes: 6 additions & 6 deletions controllers/storagecluster/odfinfoconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const (
odfDeploymentTypeInternal = "internal"
rookCephMonSecretName = "rook-ceph-mon"
fsidKey = "fsid"
odfOperatorNamePrefix = "odf-operator"
ocsOperatorNamePrefix = "ocs-operator"
odfInfoConfigMapName = "odf-info"
odfInfoMapKind = "ConfigMap"
)
Expand Down Expand Up @@ -98,7 +98,7 @@ func (obj *odfInfoConfig) ensureCreated(r *StorageClusterReconciler, storageClus
}

func (obj *odfInfoConfig) getOdfInfoKeyName(storageCluster *ocsv1.StorageCluster) string {
return fmt.Sprintf("%s/%s.%s", storageCluster.Namespace, storageCluster.Name, odfInfoKeySuffix)
return fmt.Sprintf("%s_%s.%s", storageCluster.Namespace, storageCluster.Name, odfInfoKeySuffix)
}

// ensureDeleted is dummy func for the odfInfoConfig
Expand Down Expand Up @@ -136,7 +136,7 @@ func (obj *odfInfoConfig) ensureDeleted(r *StorageClusterReconciler, storageClus
}

func getOdfInfoData(r *StorageClusterReconciler, storageCluster *ocsv1.StorageCluster) (string, error) {
odfVersion, err := getOdfVersion(r, storageCluster)
odfVersion, err := getOcsVersion(r, storageCluster)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -216,18 +216,18 @@ func getStorageSystemName(storageCluster *ocsv1.StorageCluster) (string, error)

}

func getOdfVersion(r *StorageClusterReconciler, storageCluster *ocsv1.StorageCluster) (string, error) {
func getOcsVersion(r *StorageClusterReconciler, storageCluster *ocsv1.StorageCluster) (string, error) {
var csvs operatorsv1alpha1.ClusterServiceVersionList
err := r.Client.List(r.ctx, &csvs, client.InNamespace(storageCluster.Namespace))
if err != nil {
return "", err
}

csv := util.Find(csvs.Items, func(csv *operatorsv1alpha1.ClusterServiceVersion) bool {
return strings.HasPrefix(csv.Name, odfOperatorNamePrefix)
return strings.HasPrefix(csv.Name, ocsOperatorNamePrefix)
})
if csv == nil {
return "", fmt.Errorf("failed to find csv with prefix %q", odfOperatorNamePrefix)
return "", fmt.Errorf("failed to find csv with prefix %q", ocsOperatorNamePrefix)
}
return csv.Spec.Version.String(), nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ func createFakeStorageClusterReconciler(t *testing.T, obj ...runtime.Object) Sto
}
csv := &opv1a1.ClusterServiceVersion{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("odf-operator-%s", sc.Name),
Name: fmt.Sprintf("ocs-operator-%s", sc.Name),
Namespace: namespace,
},
Spec: opv1a1.ClusterServiceVersionSpec{
Expand Down
3 changes: 3 additions & 0 deletions pkg/deploy-manager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ var InstallNamespace string
// DefaultStorageClusterName is the name of the storage cluster the test suite installs
const DefaultStorageClusterName = "test-storagecluster"

// DefaultStorageClusterStorageSystemName is the name of the storage system owned by default storage cluster
const DefaultStorageClusterStorageSystemName = "test-storage-system"

// DefaultStorageClassRBD is the name of the ceph rbd storage class the test suite installs
const DefaultStorageClassRBD = DefaultStorageClusterName + "-ceph-rbd"

Expand Down
8 changes: 8 additions & 0 deletions pkg/deploy-manager/storagecluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func (t *DeployManager) DefaultStorageCluster() (*ocsv1.StorageCluster, error) {
ObjectMeta: metav1.ObjectMeta{
Name: DefaultStorageClusterName,
Namespace: InstallNamespace,
OwnerReferences: []metav1.OwnerReference{
{
Name: DefaultStorageClusterStorageSystemName,
Kind: "StorageSystem",
APIVersion: "v1",
UID: types.UID(DefaultStorageClusterStorageSystemName),
},
},
},
Spec: ocsv1.StorageClusterSpec{
ManageNodes: false,
Expand Down

0 comments on commit 4040225

Please sign in to comment.