diff --git a/pkg/validate/application/application_test.go b/pkg/validate/application/application_test.go index 3085e091..04a635b3 100644 --- a/pkg/validate/application/application_test.go +++ b/pkg/validate/application/application_test.go @@ -12,6 +12,7 @@ import ( e2econfig "github.com/ramendr/ramen/e2e/config" "github.com/ramendr/ramen/e2e/types" + "sigs.k8s.io/yaml" basecmd "github.com/ramendr/ramenctl/pkg/command" "github.com/ramendr/ramenctl/pkg/config" @@ -163,6 +164,19 @@ func totalDuration(steps []*report.Step) float64 { return total } +func loadApplicationStatus(t *testing.T, name string) *report.ApplicationStatus { + t.Helper() + data, err := os.ReadFile(filepath.Join("testdata", name)) + if err != nil { + t.Fatalf("ReadFile(%q) error: %v", name, err) + } + s := &report.ApplicationStatus{} + if err := yaml.Unmarshal(data, s); err != nil { + t.Fatalf("Unmarshal(%q) error: %v", name, err) + } + return s +} + func dumpCommandLog(t *testing.T, cmd *Command) { log, err := os.ReadFile(cmd.LogFile()) if err != nil { diff --git a/pkg/validate/application/command_test.go b/pkg/validate/application/command_test.go index c02422fd..f6bd3139 100644 --- a/pkg/validate/application/command_test.go +++ b/pkg/validate/application/command_test.go @@ -6,10 +6,6 @@ package application import ( "context" "testing" - stdtime "time" - - ramenapi "github.com/ramendr/ramen/api/v1alpha1" - corev1 "k8s.io/api/core/v1" "github.com/ramendr/ramenctl/pkg/helpers" "github.com/ramendr/ramenctl/pkg/report" @@ -20,12 +16,6 @@ import ( const applicationTestdata = "../../testdata/appset-deploy-rbd" -// Must match the cluster-time and lastGroupSyncTime in testdata. -var ( - testClusterTime = stdtime.Date(2025, 7, 29, 17, 24, 30, 0, stdtime.UTC) - testLastGroupSyncTime = stdtime.Date(2025, 7, 29, 17, 23, 0, 0, stdtime.UTC) -) - var ( testApplication = &report.Application{ Name: drpcName, @@ -126,231 +116,8 @@ func TestValidateApplicationPassed(t *testing.T) { } checkItems(t, validate.Report.Steps[1], items) - expectedStatus := &report.ApplicationStatus{ - Hub: report.ApplicationStatusHub{ - DRPC: report.DRPCSummary{ - Name: drpcName, - Namespace: drpcNamespace, - ClusterTime: &testClusterTime, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Action: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - }, - DRPolicy: "dr-policy-1m", - SchedulingInterval: report.ValidatedDuration{ - Validated: report.Validated{ - State: report.OK, - }, - Value: stdtime.Minute, - }, - LastGroupSyncTime: report.ValidatedTime{ - Validated: report.Validated{ - State: report.OK, - }, - Value: &testLastGroupSyncTime, - }, - Phase: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.Deployed), - }, - Progression: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.ProgressionCompleted), - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "PeerReady", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Protected", - }, - }, - }, - }, - PrimaryCluster: report.ApplicationStatusCluster{ - Name: "dr1", - VRG: report.VRGSummary{ - Name: drpcName, - Namespace: applicationNamespace, - ClusterTime: &testClusterTime, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - SchedulingInterval: report.ValidatedDuration{ - Validated: report.Validated{ - State: report.OK, - }, - Value: stdtime.Minute, - }, - LastGroupSyncTime: report.ValidatedTime{ - Validated: report.Validated{ - State: report.OK, - }, - Value: &testLastGroupSyncTime, - }, - State: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.PrimaryState), - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "DataReady", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "ClusterDataReady", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "ClusterDataProtected", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "KubeObjectsReady", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "NoClusterDataConflict", - }, - }, - ProtectedPVCs: []report.ProtectedPVCSummary{ - { - Name: "busybox-pvc", - Namespace: "e2e-appset-deploy-rbd", - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Replication: report.Volrep, - Phase: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(corev1.ClaimBound), - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "DataReady", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "ClusterDataProtected", - }, - }, - }, - }, - // TODO: https://github.com/RamenDR/ramenctl/issues/330 - }, - }, - SecondaryCluster: report.ApplicationStatusCluster{ - Name: "dr2", - VRG: report.VRGSummary{ - Name: drpcName, - Namespace: applicationNamespace, - ClusterTime: &testClusterTime, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - SchedulingInterval: report.ValidatedDuration{ - Validated: report.Validated{ - State: report.OK, - }, - Value: stdtime.Minute, - }, - LastGroupSyncTime: report.ValidatedTime{ - Validated: report.Validated{ - State: report.OK, - }, - }, - State: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.SecondaryState), - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "NoClusterDataConflict", - }, - }, - }, - }, - S3: report.ApplicationS3Status{ - Profiles: report.ValidatedApplicationS3ProfileStatusList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.ApplicationS3ProfileStatus{ - { - Name: "minio-on-dr1", - Gathered: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - { - Name: "minio-on-dr2", - Gathered: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - }, - }, - }, - } + expectedStatus := loadApplicationStatus(t, "appset-deploy-rbd.yaml") + checkApplicationStatus(t, validate.Report, expectedStatus) checkSummary(t, validate.Report, report.Summary{summary.OK: 30}) diff --git a/pkg/validate/application/testdata/appset-deploy-rbd.yaml b/pkg/validate/application/testdata/appset-deploy-rbd.yaml new file mode 100644 index 00000000..fe8c40ca --- /dev/null +++ b/pkg/validate/application/testdata/appset-deploy-rbd.yaml @@ -0,0 +1,107 @@ +# Golden file for TestValidateApplicationPassed in command_test.go. +# +# Tracks the testdata under pkg/testdata/appset-deploy-rbd/. Regenerate +# this file if that testdata changes. + +hub: + drpc: + action: + state: ok ✅ + clusterTime: "2025-07-29T17:24:30Z" + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: PeerReady + - state: ok ✅ + type: Protected + deleted: + state: ok ✅ + drPolicy: dr-policy-1m + lastGroupSyncTime: + state: ok ✅ + value: "2025-07-29T17:23:00Z" + name: appset-deploy-rbd + namespace: argocd + phase: + state: ok ✅ + value: Deployed + progression: + state: ok ✅ + value: Completed + schedulingInterval: + state: ok ✅ + value: 1m0s +primaryCluster: + name: dr1 + vrg: + clusterTime: "2025-07-29T17:24:30Z" + conditions: + - state: ok ✅ + type: DataReady + - state: ok ✅ + type: ClusterDataReady + - state: ok ✅ + type: ClusterDataProtected + - state: ok ✅ + type: KubeObjectsReady + - state: ok ✅ + type: NoClusterDataConflict + deleted: + state: ok ✅ + lastGroupSyncTime: + state: ok ✅ + value: "2025-07-29T17:23:00Z" + name: appset-deploy-rbd + namespace: e2e-appset-deploy-rbd + protectedPVCs: + - conditions: + - state: ok ✅ + type: DataReady + - state: ok ✅ + type: ClusterDataProtected + deleted: + state: ok ✅ + name: busybox-pvc + namespace: e2e-appset-deploy-rbd + phase: + state: ok ✅ + value: Bound + replication: volrep + schedulingInterval: + state: ok ✅ + value: 1m0s + state: + state: ok ✅ + value: Primary +s3: + profiles: + state: ok ✅ + value: + - gathered: + state: ok ✅ + value: true + name: minio-on-dr1 + - gathered: + state: ok ✅ + value: true + name: minio-on-dr2 +secondaryCluster: + name: dr2 + vrg: + clusterTime: "2025-07-29T17:24:30Z" + conditions: + - state: ok ✅ + type: NoClusterDataConflict + deleted: + state: ok ✅ + lastGroupSyncTime: + state: ok ✅ + name: appset-deploy-rbd + namespace: e2e-appset-deploy-rbd + schedulingInterval: + state: ok ✅ + value: 1m0s + state: + state: ok ✅ + value: Secondary diff --git a/pkg/validate/clusters/clusters_test.go b/pkg/validate/clusters/clusters_test.go index c4d4c28f..2c3693c2 100644 --- a/pkg/validate/clusters/clusters_test.go +++ b/pkg/validate/clusters/clusters_test.go @@ -12,6 +12,7 @@ import ( e2econfig "github.com/ramendr/ramen/e2e/config" "github.com/ramendr/ramen/e2e/types" + "sigs.k8s.io/yaml" basecmd "github.com/ramendr/ramenctl/pkg/command" "github.com/ramendr/ramenctl/pkg/config" @@ -21,9 +22,6 @@ import ( "github.com/ramendr/ramenctl/pkg/validation" ) -// caCertificate fingerprint (SHA-256 hash) for OCP testdata. -const caCertificateFingerprint = "BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00" - // testSystem is a test system such as drenv or ocp clusters. type testSystem struct { name string @@ -147,6 +145,19 @@ func checkClusterStatus( } } +func loadClustersStatus(t *testing.T, name string) *report.ClustersStatus { + t.Helper() + data, err := os.ReadFile(filepath.Join("testdata", name)) + if err != nil { + t.Fatalf("ReadFile(%q) error: %v", name, err) + } + s := &report.ClustersStatus{} + if err := yaml.Unmarshal(data, s); err != nil { + t.Fatalf("Unmarshal(%q) error: %v", name, err) + } + return s +} + func checkSummary(t *testing.T, r *Report, expected report.Summary) { if !r.Summary.Equal(&expected) { t.Fatalf("expected summary %v, got %v", expected, *r.Summary) diff --git a/pkg/validate/clusters/command_test.go b/pkg/validate/clusters/command_test.go index 24f0c5a2..63dde592 100644 --- a/pkg/validate/clusters/command_test.go +++ b/pkg/validate/clusters/command_test.go @@ -6,10 +6,7 @@ package clusters import ( "testing" - ramenapi "github.com/ramendr/ramen/api/v1alpha1" - "github.com/ramendr/ramenctl/pkg/helpers" - "github.com/ramendr/ramenctl/pkg/ramen" "github.com/ramendr/ramenctl/pkg/report" "github.com/ramendr/ramenctl/pkg/validate/summary" ) @@ -71,575 +68,7 @@ func TestValidateClustersK8s(t *testing.T) { } checkItems(t, validate.Report.Steps[1], items) - expected := &report.ClustersStatus{ - Hub: report.ClustersStatusHub{ - DRClusters: report.ValidatedDRClustersList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.DRClusterSummary{ - { - Name: "dr1", - Phase: "Available", - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Fenced", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Clean", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - { - Name: "dr2", - Phase: "Available", - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Fenced", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Clean", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - }, - }, - DRPolicies: report.ValidatedDRPoliciesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.DRPolicySummary{ - { - Name: "dr-policy-1m", - DRClusters: []string{"dr1", "dr2"}, - SchedulingInterval: "1m", - PeerClasses: report.ValidatedPeerClassesList{ - Validated: report.Validated{ - State: report.OK, - }, - // TODO: https://github.com/RamenDR/ramenctl/issues/329 - Value: []report.PeerClassesSummary{ - { - StorageClassName: "rook-ceph-block", - ReplicationID: "rook-ceph-replication-1", - }, - { - StorageClassName: "rook-cephfs-fs1", - }, - }, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - { - Name: "dr-policy-5m", - DRClusters: []string{"dr1", "dr2"}, - SchedulingInterval: "5m", - PeerClasses: report.ValidatedPeerClassesList{ - Validated: report.Validated{ - State: report.OK, - }, - // TODO: https://github.com/RamenDR/ramenctl/issues/329 - Value: []report.PeerClassesSummary{ - { - StorageClassName: "rook-ceph-block", - ReplicationID: "rook-ceph-replication-1", - }, - { - StorageClassName: "rook-cephfs-fs1", - }, - }, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - }, - }, - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.HubOperatorConfigMapName, - Namespace: testK8s.config.Namespaces.RamenHubNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "minio-on-dr1", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-west-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr1", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - // CACertificate is optional, empty is OK if hub also has no cert. - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - { - S3ProfileName: "minio-on-dr2", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-east-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr2", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.HubOperatorName, - Namespace: testK8s.config.Namespaces.RamenHubNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRHubType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - }, - }, - }, - }, - Clusters: []report.ClustersStatusCluster{ - { - Name: "dr1", - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.DrClusterOperatorConfigMapName, - Namespace: testK8s.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "minio-on-dr1", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-west-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr1", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - { - S3ProfileName: "minio-on-dr2", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-east-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr2", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.DRClusterOperatorName, - Namespace: testK8s.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRClusterType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - }, - }, - }, - }, - { - Name: "dr2", - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.DrClusterOperatorConfigMapName, - Namespace: testK8s.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "minio-on-dr1", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-west-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr1", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - { - S3ProfileName: "minio-on-dr2", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "bucket", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "http://example-cluster:30000", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "us-east-1", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "ramen-s3-secret-dr2", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: testK8s.config.Namespaces.RamenHubNamespace, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.DRClusterOperatorName, - Namespace: testK8s.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRClusterType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - }, - }, - }, - }, - }, - S3: report.ClustersS3Status{ - Profiles: report.ValidatedClustersS3ProfileStatusList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.ClustersS3ProfileStatus{ - { - Name: "minio-on-dr1", - Accessible: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - { - Name: "minio-on-dr2", - Accessible: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - }, - }, - }, - } + expected := loadClustersStatus(t, "k8s-status.yaml") checkClusterStatus(t, validate.Report, expected) checkSummary(t, validate.Report, report.Summary{summary.OK: 93}) @@ -685,552 +114,7 @@ func TestValidateClustersOcp(t *testing.T) { } checkItems(t, validate.Report.Steps[1], items) - expected := &report.ClustersStatus{ - Hub: report.ClustersStatusHub{ - DRClusters: report.ValidatedDRClustersList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.DRClusterSummary{ - { - Name: "c1", - Phase: "Available", - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Fenced", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Clean", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - { - Name: "c2", - Phase: "Available", - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Fenced", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Clean", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - }, - }, - DRPolicies: report.ValidatedDRPoliciesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.DRPolicySummary{ - { - Name: "odr-policy-5m", - DRClusters: []string{"c1", "c2"}, - SchedulingInterval: "5m", - PeerClasses: report.ValidatedPeerClassesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.PeerClassesSummary{ - { - StorageClassName: "ocs-storagecluster-ceph-rbd", - ReplicationID: "275fb2e9822a88bfbfb96516fd307ff3", - Grouping: true, - }, - { - StorageClassName: "ocs-storagecluster-ceph-rbd-virtualization", - ReplicationID: "275fb2e9822a88bfbfb96516fd307ff3", - Grouping: true, - }, - { - StorageClassName: "ocs-storagecluster-cephfs", - Grouping: true, - }, - }, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Validated", - }, - }, - }, - }, - }, - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.HubOperatorConfigMapName, - Namespace: testOcp.config.Namespaces.RamenHubNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "s3profile-c1-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c1.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "5e88331f09006ac31169b027235b50fd94458b6", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - { - S3ProfileName: "s3profile-c2-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c2.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "020a140310eb1fce63e2087087d9a0bdf972b93", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.HubOperatorName, - Namespace: testOcp.config.Namespaces.RamenHubNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRHubType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - }, - }, - }, - }, - Clusters: []report.ClustersStatusCluster{ - { - Name: "c1", - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.DrClusterOperatorConfigMapName, - Namespace: testOcp.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "s3profile-c1-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c1.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "5e88331f09006ac31169b027235b50fd94458b6", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - { - S3ProfileName: "s3profile-c2-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c2.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "020a140310eb1fce63e2087087d9a0bdf972b93", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.DRClusterOperatorName, - Namespace: testOcp.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRClusterType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - }, - }, - }, - }, - { - Name: "c2", - Ramen: report.RamenSummary{ - ConfigMap: report.ConfigMapSummary{ - Name: ramen.DrClusterOperatorConfigMapName, - Namespace: testOcp.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - Parsed: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - S3StoreProfiles: report.ValidatedS3StoreProfilesList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.S3StoreProfilesSummary{ - { - S3ProfileName: "s3profile-c1-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c1.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "5e88331f09006ac31169b027235b50fd94458b6", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - { - S3ProfileName: "s3profile-c2-ocs-storagecluster", - S3Bucket: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "odrbucket-244c8f95bf0d", - }, - S3CompatibleEndpoint: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "https://s3-openshift-storage.apps.c2.example.com", - }, - S3Region: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "noobaa", - }, - S3SecretRef: report.S3SecretSummary{ - Name: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - Value: "020a140310eb1fce63e2087087d9a0bdf972b93", - }, - Namespace: report.ValidatedString{ - Validated: report.Validated{State: report.OK}, - }, - Deleted: report.ValidatedBool{ - Validated: report.Validated{State: report.OK}, - }, - AWSAccessKeyID: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyIDFingerprint, - }, - AWSSecretAccessKey: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: helpers.FakeAWSKeyFingerprint, - }, - }, - CACertificate: report.ValidatedFingerprint{ - Validated: report.Validated{State: report.OK}, - Value: caCertificateFingerprint, - }, - }, - }, - }, - }, - Deployment: report.DeploymentSummary{ - Name: ramen.DRClusterOperatorName, - Namespace: testOcp.config.Namespaces.RamenDRClusterNamespace, - Deleted: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - }, - RamenControllerType: report.ValidatedString{ - Validated: report.Validated{ - State: report.OK, - }, - Value: string(ramenapi.DRClusterType), - }, - Replicas: report.ValidatedInteger{ - Validated: report.Validated{ - State: report.OK, - }, - Value: 1, - }, - Conditions: []report.ValidatedCondition{ - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Available", - }, - { - Validated: report.Validated{ - State: report.OK, - }, - Type: "Progressing", - }, - }, - }, - }, - }, - }, - S3: report.ClustersS3Status{ - Profiles: report.ValidatedClustersS3ProfileStatusList{ - Validated: report.Validated{ - State: report.OK, - }, - Value: []report.ClustersS3ProfileStatus{ - { - Name: "s3profile-c1-ocs-storagecluster", - Accessible: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - { - Name: "s3profile-c2-ocs-storagecluster", - Accessible: report.ValidatedBool{ - Validated: report.Validated{ - State: report.OK, - }, - Value: true, - }, - }, - }, - }, - }, - } + expected := loadClustersStatus(t, "ocp-status.yaml") checkClusterStatus(t, validate.Report, expected) checkSummary(t, validate.Report, report.Summary{summary.OK: 91}) diff --git a/pkg/validate/clusters/testdata/k8s-status.yaml b/pkg/validate/clusters/testdata/k8s-status.yaml new file mode 100644 index 00000000..07df327c --- /dev/null +++ b/pkg/validate/clusters/testdata/k8s-status.yaml @@ -0,0 +1,319 @@ +# Golden file for TestValidateClustersK8s in command_test.go. +# +# Tracks the testdata under pkg/testdata/clusters/k8s/. Regenerate this +# file if that testdata changes. + +clusters: +- name: dr1 + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator-config + namespace: ramen-system + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr1 + region: + state: ok ✅ + value: us-west-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr1 + namespace: + state: ok ✅ + value: ramen-system + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr2 + region: + state: ok ✅ + value: us-east-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr2 + namespace: + state: ok ✅ + value: ramen-system + deployment: + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: Progressing + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator + namespace: ramen-system + ramenControllerType: + state: ok ✅ + value: dr-cluster + replicas: + state: ok ✅ + value: 1 +- name: dr2 + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator-config + namespace: ramen-system + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr1 + region: + state: ok ✅ + value: us-west-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr1 + namespace: + state: ok ✅ + value: ramen-system + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr2 + region: + state: ok ✅ + value: us-east-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr2 + namespace: + state: ok ✅ + value: ramen-system + deployment: + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: Progressing + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator + namespace: ramen-system + ramenControllerType: + state: ok ✅ + value: dr-cluster + replicas: + state: ok ✅ + value: 1 +hub: + drClusters: + state: ok ✅ + value: + - conditions: + - state: ok ✅ + type: Fenced + - state: ok ✅ + type: Clean + - state: ok ✅ + type: Validated + name: dr1 + phase: Available + - conditions: + - state: ok ✅ + type: Fenced + - state: ok ✅ + type: Clean + - state: ok ✅ + type: Validated + name: dr2 + phase: Available + drPolicies: + state: ok ✅ + value: + - conditions: + - state: ok ✅ + type: Validated + drClusters: + - dr1 + - dr2 + name: dr-policy-1m + peerClasses: + state: ok ✅ + value: + - replicationID: rook-ceph-replication-1 + storageClassName: rook-ceph-block + - storageClassName: rook-cephfs-fs1 + schedulingInterval: 1m + - conditions: + - state: ok ✅ + type: Validated + drClusters: + - dr1 + - dr2 + name: dr-policy-5m + peerClasses: + state: ok ✅ + value: + - replicationID: rook-ceph-replication-1 + storageClassName: rook-ceph-block + - storageClassName: rook-cephfs-fs1 + schedulingInterval: 5m + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-hub-operator-config + namespace: ramen-system + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr1 + region: + state: ok ✅ + value: us-west-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr1 + namespace: + state: ok ✅ + value: ramen-system + - bucket: + state: ok ✅ + value: bucket + caCertificate: + state: ok ✅ + endpoint: + state: ok ✅ + value: http://example-cluster:30000 + profileName: minio-on-dr2 + region: + state: ok ✅ + value: us-east-1 + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: ramen-s3-secret-dr2 + namespace: + state: ok ✅ + value: ramen-system + deployment: + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: Progressing + deleted: + state: ok ✅ + name: ramen-hub-operator + namespace: ramen-system + ramenControllerType: + state: ok ✅ + value: dr-hub + replicas: + state: ok ✅ + value: 1 +s3: + profiles: + state: ok ✅ + value: + - accessible: + state: ok ✅ + value: true + name: minio-on-dr1 + - accessible: + state: ok ✅ + value: true + name: minio-on-dr2 diff --git a/pkg/validate/clusters/testdata/ocp-status.yaml b/pkg/validate/clusters/testdata/ocp-status.yaml new file mode 100644 index 00000000..c5993e5a --- /dev/null +++ b/pkg/validate/clusters/testdata/ocp-status.yaml @@ -0,0 +1,310 @@ +# Golden file for TestValidateClustersOcp in command_test.go. +# +# Tracks the testdata under pkg/testdata/clusters/ocp/. Regenerate this +# file if that testdata changes. + +clusters: +- name: c1 + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator-config + namespace: openshift-dr-system + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c1.example.com + profileName: s3profile-c1-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 5e88331f09006ac31169b027235b50fd94458b6 + namespace: + state: ok ✅ + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c2.example.com + profileName: s3profile-c2-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 020a140310eb1fce63e2087087d9a0bdf972b93 + namespace: + state: ok ✅ + deployment: + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: Progressing + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator + namespace: openshift-dr-system + ramenControllerType: + state: ok ✅ + value: dr-cluster + replicas: + state: ok ✅ + value: 1 +- name: c2 + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator-config + namespace: openshift-dr-system + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c1.example.com + profileName: s3profile-c1-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 5e88331f09006ac31169b027235b50fd94458b6 + namespace: + state: ok ✅ + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c2.example.com + profileName: s3profile-c2-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 020a140310eb1fce63e2087087d9a0bdf972b93 + namespace: + state: ok ✅ + deployment: + conditions: + - state: ok ✅ + type: Available + - state: ok ✅ + type: Progressing + deleted: + state: ok ✅ + name: ramen-dr-cluster-operator + namespace: openshift-dr-system + ramenControllerType: + state: ok ✅ + value: dr-cluster + replicas: + state: ok ✅ + value: 1 +hub: + drClusters: + state: ok ✅ + value: + - conditions: + - state: ok ✅ + type: Fenced + - state: ok ✅ + type: Clean + - state: ok ✅ + type: Validated + name: c1 + phase: Available + - conditions: + - state: ok ✅ + type: Fenced + - state: ok ✅ + type: Clean + - state: ok ✅ + type: Validated + name: c2 + phase: Available + drPolicies: + state: ok ✅ + value: + - conditions: + - state: ok ✅ + type: Validated + drClusters: + - c1 + - c2 + name: odr-policy-5m + peerClasses: + state: ok ✅ + value: + - grouping: true + replicationID: 275fb2e9822a88bfbfb96516fd307ff3 + storageClassName: ocs-storagecluster-ceph-rbd + - grouping: true + replicationID: 275fb2e9822a88bfbfb96516fd307ff3 + storageClassName: ocs-storagecluster-ceph-rbd-virtualization + - grouping: true + storageClassName: ocs-storagecluster-cephfs + schedulingInterval: 5m + ramen: + configmap: + deleted: + state: ok ✅ + name: ramen-hub-operator-config + namespace: openshift-operators + parsed: + state: ok ✅ + value: true + s3StoreProfiles: + state: ok ✅ + value: + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c1.example.com + profileName: s3profile-c1-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 5e88331f09006ac31169b027235b50fd94458b6 + namespace: + state: ok ✅ + - bucket: + state: ok ✅ + value: odrbucket-244c8f95bf0d + caCertificate: + state: ok ✅ + value: BA:A5:C7:3B:3F:6E:06:27:19:F5:45:FC:6F:07:42:81:3B:F6:4D:61:95:CC:D5:D8:79:22:65:63:35:63:97:00 + endpoint: + state: ok ✅ + value: https://s3-openshift-storage.apps.c2.example.com + profileName: s3profile-c2-ocs-storagecluster + region: + state: ok ✅ + value: noobaa + secret: + awsAccessKeyID: + state: ok ✅ + value: F3:1C:B8:5A:2C:33:BA:C3:57:84:22:D5:11:F5:35:40:FF:A8:6A:34:B8:CD:42:AC:86:65:E2:2B:E1:05:EA:23 + awsSecretAccessKey: + state: ok ✅ + value: BC:42:FE:14:DB:F0:91:1C:91:1F:8F:CF:72:AF:CE:C5:83:5C:AF:93:AC:08:40:CE:31:D8:67:CA:AC:BC:E4:16 + deleted: + state: ok ✅ + name: + state: ok ✅ + value: 020a140310eb1fce63e2087087d9a0bdf972b93 + namespace: + state: ok ✅ + deployment: + conditions: + - state: ok ✅ + type: Progressing + - state: ok ✅ + type: Available + deleted: + state: ok ✅ + name: ramen-hub-operator + namespace: openshift-operators + ramenControllerType: + state: ok ✅ + value: dr-hub + replicas: + state: ok ✅ + value: 1 +s3: + profiles: + state: ok ✅ + value: + - accessible: + state: ok ✅ + value: true + name: s3profile-c1-ocs-storagecluster + - accessible: + state: ok ✅ + value: true + name: s3profile-c2-ocs-storagecluster