diff --git a/e2e/config.yaml b/e2e/config.yaml index f44ed19c3..34b779f03 100644 --- a/e2e/config.yaml +++ b/e2e/config.yaml @@ -9,3 +9,5 @@ pvcspecs: - name: cephfs storageclassname: rook-cephfs accessmodes: ReadWriteMany + unsupportedDeployers: + - disapp diff --git a/e2e/deployers/applicationset.go b/e2e/deployers/applicationset.go index 835e226b8..f86fc0ea9 100644 --- a/e2e/deployers/applicationset.go +++ b/e2e/deployers/applicationset.go @@ -80,17 +80,13 @@ func (a ApplicationSet) Undeploy(ctx types.Context) error { } func (a ApplicationSet) GetName() string { - return "Appset" + return "appset" } func (a ApplicationSet) GetNamespace() string { return util.ArgocdNamespace } -func (a ApplicationSet) IsWorkloadSupported(w types.Workload) bool { - return true -} - func (a ApplicationSet) IsDiscovered() bool { return false } diff --git a/e2e/deployers/discoveredapp.go b/e2e/deployers/discoveredapp.go index 54973c315..bc3f8d41a 100644 --- a/e2e/deployers/discoveredapp.go +++ b/e2e/deployers/discoveredapp.go @@ -15,7 +15,7 @@ import ( type DiscoveredApp struct{} func (d DiscoveredApp) GetName() string { - return "Disapp" + return "disapp" } func (d DiscoveredApp) GetNamespace() string { @@ -114,10 +114,6 @@ func (d DiscoveredApp) Undeploy(ctx types.Context) error { return nil } -func (d DiscoveredApp) IsWorkloadSupported(w types.Workload) bool { - return w.GetName() != "Deploy-cephfs" -} - func (d DiscoveredApp) IsDiscovered() bool { return true } diff --git a/e2e/deployers/subscription.go b/e2e/deployers/subscription.go index f3e0003e1..d6bf4ae7f 100644 --- a/e2e/deployers/subscription.go +++ b/e2e/deployers/subscription.go @@ -15,7 +15,7 @@ const McsbName = ClusterSetName type Subscription struct{} func (s Subscription) GetName() string { - return "Subscr" + return "subscr" } func (s Subscription) GetNamespace() string { @@ -86,10 +86,6 @@ func (s Subscription) Undeploy(ctx types.Context) error { return util.DeleteNamespace(util.Ctx.Hub.Client, namespace, log) } -func (s Subscription) IsWorkloadSupported(w types.Workload) bool { - return true -} - func (s Subscription) IsDiscovered() bool { return false } diff --git a/e2e/test/context.go b/e2e/test/context.go index 31e112e5a..40b4d9863 100644 --- a/e2e/test/context.go +++ b/e2e/test/context.go @@ -59,8 +59,8 @@ func (c *Context) Logger() *zap.SugaredLogger { // Validated return an error if the combination of deployer and workload is not supported. // TODO: validate that the workload is compatible with the clusters. func (c *Context) Validate() error { - if !c.deployer.IsWorkloadSupported(c.workload) { - return fmt.Errorf("workload %q not supported by deployer %q", c.workload.GetName(), c.deployer.GetName()) + if !c.workload.SupportsDeployer(c.deployer) { + return fmt.Errorf("workload %q does not support deployer %q", c.workload.GetName(), c.deployer.GetName()) } return nil diff --git a/e2e/types/types.go b/e2e/types/types.go index ca38004b6..bfced6dc5 100644 --- a/e2e/types/types.go +++ b/e2e/types/types.go @@ -15,7 +15,6 @@ type Deployer interface { GetName() string // GetNamespace return the namespace for the ramen resources, or empty string if not using a special namespace. GetNamespace() string - IsWorkloadSupported(Workload) bool // Return true for OCM discovered application, false for OCM managed applications. IsDiscovered() bool } @@ -29,6 +28,9 @@ type Workload interface { GetPath() string GetRevision() string + // SupportsDeployer returns tue if this workload is compatible with deployer. + SupportsDeployer(Deployer) bool + // TODO: replace client with cluster. Health(ctx Context, client client.Client, namespace string) error } diff --git a/e2e/util/config.go b/e2e/util/config.go index 230a1e51f..6e03e8186 100644 --- a/e2e/util/config.go +++ b/e2e/util/config.go @@ -11,9 +11,10 @@ import ( ) type PVCSpec struct { - Name string - StorageClassName string - AccessModes string + Name string + StorageClassName string + AccessModes string + UnsupportedDeployers []string } type TestConfig struct { ChannelName string diff --git a/e2e/workloads/deployment.go b/e2e/workloads/deployment.go index b0cdd1740..6d6189b35 100644 --- a/e2e/workloads/deployment.go +++ b/e2e/workloads/deployment.go @@ -5,6 +5,8 @@ package workloads import ( "context" + "slices" + "strings" "github.com/ramendr/ramen/e2e/types" "github.com/ramendr/ramen/e2e/util" @@ -37,6 +39,10 @@ func (w Deployment) GetRevision() string { return w.Revision } +func (w Deployment) SupportsDeployer(d types.Deployer) bool { + return !slices.Contains(w.PVCSpec.UnsupportedDeployers, strings.ToLower(d.GetName())) +} + func (w Deployment) Kustomize() string { if w.PVCSpec.StorageClassName == "" && w.PVCSpec.AccessModes == "" { return ""