Repository: redhat-openshift-ecosystem/openshift-preflight (go)

Issue:
Add unit tests for DeployableByOLM Check
## Bug Description
Add unit tests for DeployableByOLM Check

## Version and Command Invocation
(The output of `preflight --version`)

## Steps to Reproduce:
(How can we reproduce this?)
1)
2)
3)

## Expected Result
(What did you expect to happen and why?)


## Actual Result
(What actually happened)


## Additional Context
(Anything else you think might help us troubleshoot, like your platform, dependency versions, etc).


Pull request description:
Add unit tests for deployableByOLM check + refactoring
Add unit tests for deployableByOLM check + refactoring

Fixes #198 

Patch:
diff --git a/certification/engine/engine.go b/certification/engine/engine.go
index 86309d2..a5ffe05 100644
--- a/certification/engine/engine.go
+++ b/certification/engine/engine.go
@@ -73,7 +73,7 @@ func queryChecks(checkName string) certification.Check {
 var operatorPkgNameIsUniqueCheck certification.Check = &operatorpol.OperatorPkgNameIsUniqueCheck{}
 var scorecardBasicSpecCheck certification.Check = operatorpol.NewScorecardBasicSpecCheck(internal.NewOperatorSdkEngine())
 var scorecardOlmSuiteCheck certification.Check = operatorpol.NewScorecardOlmSuiteCheck(internal.NewOperatorSdkEngine())
-var deployableByOlmCheck certification.Check = &operatorpol.DeployableByOlmCheck{}
+var deployableByOlmCheck certification.Check = operatorpol.NewDeployableByOlmCheck(internal.NewOpenshiftEngine())
 var validateOperatorBundle certification.Check = operatorpol.NewValidateOperatorBundleCheck(internal.NewOperatorSdkEngine())
 
 // Container checks
diff --git a/certification/internal/cli/openshift.go b/certification/internal/cli/openshift.go
index ed9e2b0..7cb5fc8 100644
--- a/certification/internal/cli/openshift.go
+++ b/certification/internal/cli/openshift.go
@@ -4,7 +4,6 @@ import (
 	operatorv1 "github.com/operator-framework/api/pkg/operators/v1"
 	operatorv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
 	corev1 "k8s.io/api/core/v1"
-	"k8s.io/client-go/rest"
 )
 
 type OpenshiftOptions struct {
@@ -12,12 +11,6 @@ type OpenshiftOptions struct {
 	Labels    map[string]string
 }
 
-type OpenshiftReport struct {
-	Stdout string
-	Stderr string
-	Items  []OperatorSdkScorecardItem `json:"items"`
-}
-
 type SubscriptionData struct {
 	Name                   string
 	Channel                string
@@ -37,21 +30,23 @@ type OperatorGroupData struct {
 }
 
 type OpenshiftEngine interface {
-	CreateNamespace(name string, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	DeleteNamespace(name string, opts OpenshiftOptions, config *rest.Config) error
-	GetNamespace(name string, config *rest.Config) (*corev1.Namespace, error)
+	Setup() error
+
+	CreateNamespace(name string, opts OpenshiftOptions) (*corev1.Namespace, error)
+	DeleteNamespace(name string, opts OpenshiftOptions) error
+	GetNamespace(name string) (*corev1.Namespace, error)
 
-	CreateOperatorGroup(data OperatorGroupData, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	DeleteOperatorGroup(name string, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	GetOperatorGroup(name string, opts OpenshiftOptions, config *rest.Config) (*operatorv1.OperatorGroup, error)
+	CreateOperatorGroup(data OperatorGroupData, opts OpenshiftOptions) (*operatorv1.OperatorGroup, error)
+	DeleteOperatorGroup(name string, opts OpenshiftOptions) error
+	GetOperatorGroup(name string, opts OpenshiftOptions) (*operatorv1.OperatorGroup, error)
 
-	CreateCatalogSource(data CatalogSourceData, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	DeleteCatalogSource(name string, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	GetCatalogSource(name string, opts OpenshiftOptions, config *rest.Config) (*operatorv1alpha1.CatalogSource, error)
+	CreateCatalogSource(data CatalogSourceData, opts OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error)
+	DeleteCatalogSource(name string, opts OpenshiftOptions) error
+	GetCatalogSource(name string, opts OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error)
 
-	CreateSubscription(data SubscriptionData, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	DeleteSubscription(name string, opts OpenshiftOptions, config *rest.Config) (*OpenshiftReport, error)
-	GetSubscription(name string, opts OpenshiftOptions, config *rest.Config) (*operatorv1alpha1.Subscription, error)
+	CreateSubscription(data SubscriptionData, opts OpenshiftOptions) (*operatorv1alpha1.Subscription, error)
+	DeleteSubscription(name string, opts OpenshiftOptions) error
+	GetSubscription(name string, opts OpenshiftOptions) (*operatorv1alpha1.Subscription, error)
 
-	GetCSV(name string, opts OpenshiftOptions, config *rest.Config) (*operatorv1alpha1.ClusterServiceVersion, error)
+	GetCSV(name string, opts OpenshiftOptions) (*operatorv1alpha1.ClusterServiceVersion, error)
 }
diff --git a/certification/internal/engine/openshift.go b/certification/internal/engine/openshift.go
index 3ba7312..81af8cc 100644
--- a/certification/internal/engine/openshift.go
+++ b/certification/internal/engine/openshift.go
@@ -3,6 +3,7 @@ package engine
 import (
 	"context"
 	"fmt"
+	"os"
 
 	log "github.com/sirupsen/logrus"
 
@@ -15,15 +16,31 @@ import (
 	operatorv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
 	client "github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/client"
+	"k8s.io/client-go/tools/clientcmd"
 )
 
-type OpenshiftEngine struct {
+type openshiftEngine struct {
 	KubeConfig *rest.Config
 }
 
-func (pe OpenshiftEngine) CreateNamespace(name string, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
+func NewOpenshiftEngine() *cli.OpenshiftEngine {
+	var engine cli.OpenshiftEngine = &openshiftEngine{}
+	return &engine
+}
+
+func (oe *openshiftEngine) Setup() error {
+	k8sconfig, err := clientcmd.BuildConfigFromFlags("", os.Getenv("KUBECONFIG"))
+	if err != nil {
+		log.Error("unable to parse kubecofig: ", err)
+		return err
+	}
+	oe.KubeConfig = k8sconfig
+	return nil
+}
+
+func (oe *openshiftEngine) CreateNamespace(name string, opts cli.OpenshiftOptions) (*corev1.Namespace, error) {
 
-	k8sClientset, err := kubernetes.NewForConfig(pe.KubeConfig)
+	k8sClientset, err := kubernetes.NewForConfig(oe.KubeConfig)
 
 	if err != nil {
 		log.Error("unable to obtain k8s client: ", err)
@@ -42,24 +59,18 @@ func (pe OpenshiftEngine) CreateNamespace(name string, opts cli.OpenshiftOptions
 		Create(context.Background(), nsSpec, metav1.CreateOptions{})
 
 	if err != nil {
-		log.Error(fmt.Sprintf("error while creating Namespace %s:", name), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		log.Error(fmt.Sprintf("error while creating Namespace %s: ", name), err)
+		return nil, err
 	}
 
 	log.Debug("Namespace created: ", name)
 	log.Trace("Received Namespace object from API server: ", resp)
 
-	return &cli.OpenshiftReport{
-		Stdout: nsSpec.String(),
-		Stderr: "",
-	}, nil
+	return resp, nil
 }
 
-func (pe OpenshiftEngine) DeleteNamespace(name string, opts cli.OpenshiftOptions) error {
-	k8sClientset, err := kubernetes.NewForConfig(pe.KubeConfig)
+func (oe *openshiftEngine) DeleteNamespace(name string, opts cli.OpenshiftOptions) error {
+	k8sClientset, err := kubernetes.NewForConfig(oe.KubeConfig)
 
 	if err != nil {
 		log.Error("unable to obtain k8s client: ", err)
@@ -71,8 +82,8 @@ func (pe OpenshiftEngine) DeleteNamespace(name string, opts cli.OpenshiftOptions
 		Delete(context.Background(), name, metav1.DeleteOptions{})
 }
 
-func (pe OpenshiftEngine) GetNamespace(name string) (*corev1.Namespace, error) {
-	k8sClientset, err := kubernetes.NewForConfig(pe.KubeConfig)
+func (oe *openshiftEngine) GetNamespace(name string) (*corev1.Namespace, error) {
+	k8sClientset, err := kubernetes.NewForConfig(oe.KubeConfig)
 
 	if err != nil {
 		log.Error("unable to obtain k8s client: ", err)
@@ -84,230 +95,161 @@ func (pe OpenshiftEngine) GetNamespace(name string) (*corev1.Namespace, error) {
 		Get(context.Background(), name, metav1.GetOptions{})
 }
 
-func (pe OpenshiftEngine) CreateOperatorGroup(data cli.OperatorGroupData, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
+func (oe *openshiftEngine) CreateOperatorGroup(data cli.OperatorGroupData, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
 
-	crdClient, err := client.OperatorGroupClient(pe.KubeConfig, opts.Namespace)
+	ogClient, err := client.OperatorGroupClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for OperatorGroup: ", err)
 		return nil, err
 	}
 
 	log.Debug(fmt.Sprintf("Creating OperatorGroup %s in namespace %s", data.Name, opts.Namespace))
-	resp, err := crdClient.Create(data, opts)
+	resp, err := ogClient.Create(data, opts)
 
 	if err != nil {
-		log.Error(fmt.Sprintf("error while creating OperatorGroup: %s", data.Name), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		log.Error(fmt.Sprintf("error while creating OperatorGroup %s: ", data.Name), err)
+		return nil, err
 	}
 	log.Debug(fmt.Sprintf("OperatorGroup %s is created successfully in namespace %s", data.Name, opts.Namespace))
 
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", resp),
-		Stderr: "",
-	}, nil
+	return resp, nil
 }
 
-func (pe OpenshiftEngine) DeleteOperatorGroup(name string, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
-	crdClient, err := client.OperatorGroupClient(pe.KubeConfig, opts.Namespace)
+func (oe *openshiftEngine) DeleteOperatorGroup(name string, opts cli.OpenshiftOptions) error {
+	ogClient, err := client.OperatorGroupClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for OperatorGroup: ", err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("Deleting OperatorGroup %s in namespace %s", name, opts.Namespace))
 
-	err = crdClient.Delete(name, opts)
+	err = ogClient.Delete(name, opts)
 	if err != nil {
 		log.Error(fmt.Sprintf("error while deleting OperatorGroup %s in namespace %s: ", name, opts.Namespace), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("OperatorGroup %s is deleted successfully from namespace %s", name, opts.Namespace))
 
-	cs, err := pe.GetOperatorGroup(name, opts)
-	if err != nil {
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
-	}
-
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", cs),
-		Stderr: "",
-	}, nil
+	return nil
 
 }
 
-func (pe OpenshiftEngine) GetOperatorGroup(name string, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
-	crdClient, err := client.OperatorGroupClient(pe.KubeConfig, opts.Namespace)
+func (oe *openshiftEngine) GetOperatorGroup(name string, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
+	ogClient, err := client.OperatorGroupClient(oe.KubeConfig, opts.Namespace)
 
 	if err != nil {
 		log.Error("unable to obtain k8s client: ", err)
 		return nil, err
 	}
 	log.Debug(fmt.Sprintf("fetching operatorgroup %s from namespace %s ", name, opts.Namespace))
-	return crdClient.Get(name, opts.Namespace)
+	return ogClient.Get(name, opts.Namespace)
 }
 
-func (pe OpenshiftEngine) CreateCatalogSource(data cli.CatalogSourceData, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
+func (oe openshiftEngine) CreateCatalogSource(data cli.CatalogSourceData, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
 
-	crdClient, err := client.CatalogSourceClient(pe.KubeConfig, opts.Namespace)
+	csClient, err := client.CatalogSourceClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for CatalogSource: ", err)
 		return nil, err
 	}
 
 	log.Debug(fmt.Sprintf("Creating CatalogSource %s in namespace %s", data.Name, opts.Namespace))
-	resp, err := crdClient.Create(data, opts)
+	resp, err := csClient.Create(data, opts)
 
 	if err != nil {
 		log.Error(fmt.Sprintf("error while creating CatalogSource %s: ", data.Name), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return nil, err
 	}
 	log.Debug(fmt.Sprintf("CatalogSource %s is created successfully in namespace %s", data.Name, opts.Namespace))
 
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", resp),
-		Stderr: "",
-	}, nil
+	return resp, nil
 }
 
-func (pe OpenshiftEngine) DeleteCatalogSource(name string, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
-	crdClient, err := client.CatalogSourceClient(pe.KubeConfig, opts.Namespace)
+func (oe *openshiftEngine) DeleteCatalogSource(name string, opts cli.OpenshiftOptions) error {
+	csClient, err := client.CatalogSourceClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for CatalogSource: ", err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("Deleting CatalogSource %s in namespace %s", name, opts.Namespace))
 
-	err = crdClient.Delete(name, opts)
+	err = csClient.Delete(name, opts)
 	if err != nil {
 		log.Error(fmt.Sprintf("error while deleting CatalogSource %s in namespace %s: ", name, opts.Namespace), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("CatalogSource %s is deleted successfully from namespace %s", name, opts.Namespace))
 
-	cs, err := pe.GetCatalogSource(name, opts)
-	if err != nil {
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
-	}
-
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", cs),
-		Stderr: "",
-	}, nil
+	return nil
 }
 
-func (pe OpenshiftEngine) GetCatalogSource(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
+func (oe *openshiftEngine) GetCatalogSource(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
 
-	crdClient, err := client.CatalogSourceClient(pe.KubeConfig, opts.Namespace)
+	csClient, err := client.CatalogSourceClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for CatalogSource: ", err)
 		return nil, err
 	}
 	log.Debug("fetching catalogsource: " + name)
-	return crdClient.Get(name, opts.Namespace)
+	return csClient.Get(name, opts.Namespace)
 }
 
-func (pe OpenshiftEngine) CreateSubscription(data cli.SubscriptionData, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
+func (oe openshiftEngine) CreateSubscription(data cli.SubscriptionData, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
 
-	crdClient, err := client.SubscriptionClient(pe.KubeConfig, opts.Namespace)
+	subsClient, err := client.SubscriptionClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for Subscription: ", err)
 		return nil, err
 	}
 
 	log.Debug(fmt.Sprintf("Creating Subscription %s in namespace %s", data.Name, opts.Namespace))
-	resp, err := crdClient.Create(data, opts)
+	resp, err := subsClient.Create(data, opts)
 
 	if err != nil {
 		log.Error(fmt.Sprintf("error while creating Subscription %s: ", data.Name), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return nil, err
 	}
 	log.Debug(fmt.Sprintf("Subscription %s is created successfully in namespace %s", data.Name, opts.Namespace))
 
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", resp),
-		Stderr: "",
-	}, nil
+	return resp, nil
 }
 
-func (pe OpenshiftEngine) GetSubscription(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
-	crdClient, err := client.SubscriptionClient(pe.KubeConfig, opts.Namespace)
+func (oe *openshiftEngine) GetSubscription(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
+	subsClient, err := client.SubscriptionClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for Subscription: ", err)
 		return nil, err
 	}
 	log.Debug(fmt.Sprintf("fetching subscription %s from namespace %s ", name, opts.Namespace))
-	return crdClient.Get(name, opts.Namespace)
+	return subsClient.Get(name, opts.Namespace)
 }
 
-func (pe OpenshiftEngine) DeleteSubscription(name string, opts cli.OpenshiftOptions) (*cli.OpenshiftReport, error) {
+func (oe openshiftEngine) DeleteSubscription(name string, opts cli.OpenshiftOptions) error {
 
-	crdClient, err := client.SubscriptionClient(pe.KubeConfig, opts.Namespace)
+	subsClient, err := client.SubscriptionClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for Subscription: ", err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("Deleting Subscription %s in namespace %s", name, opts.Namespace))
 
-	err = crdClient.Delete(name, opts)
+	err = subsClient.Delete(name, opts)
 	if err != nil {
 		log.Error(fmt.Sprintf("error while deleting Subscription %s in namespace %s: ", name, opts.Namespace), err)
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
+		return err
 	}
 	log.Debug(fmt.Sprintf("Subscription %s is deleted successfully from namespace %s", name, opts.Namespace))
 
-	cs, err := pe.GetSubscription(name, opts)
-	if err != nil {
-		return &cli.OpenshiftReport{
-			Stdout: "",
-			Stderr: err.Error(),
-		}, err
-	}
-
-	return &cli.OpenshiftReport{
-		Stdout: fmt.Sprintf("%#v", cs),
-		Stderr: "",
-	}, nil
+	return nil
 }
 
-func (pe OpenshiftEngine) GetCSV(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.ClusterServiceVersion, error) {
+func (oe *openshiftEngine) GetCSV(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.ClusterServiceVersion, error) {
 
-	crdClient, err := client.CsvClient(pe.KubeConfig, opts.Namespace)
+	csvClient, err := client.CsvClient(oe.KubeConfig, opts.Namespace)
 	if err != nil {
 		log.Error("unable to create a client for csv: ", err)
 		return nil, err
 	}
 	log.Debug(fmt.Sprintf("fetching csv %s from namespace %s ", name, opts.Namespace))
-	return crdClient.Get(name, opts.Namespace)
+	return csvClient.Get(name, opts.Namespace)
 }
diff --git a/certification/internal/policy/operator/deployable_by_olm.go b/certification/internal/policy/operator/deployable_by_olm.go
index a73c84e..009a87f 100644
--- a/certification/internal/policy/operator/deployable_by_olm.go
+++ b/certification/internal/policy/operator/deployable_by_olm.go
@@ -3,7 +3,6 @@ package operator
 import (
 	"context"
 	"fmt"
-	"os"
 	"strings"
 	"time"
 
@@ -14,11 +13,10 @@ import (
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/artifacts"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/errors"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
-	openshiftengine "github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/engine"
+
 	log "github.com/sirupsen/logrus"
 	yaml "gopkg.in/yaml.v2"
 	kubeErr "k8s.io/apimachinery/pkg/api/errors"
-	"k8s.io/client-go/tools/clientcmd"
 )
 
 type OperatorData struct {
@@ -29,48 +27,47 @@ type OperatorData struct {
 	InstallNamespace string
 }
 
-type DeployableByOlmCheck struct{}
+type DeployableByOlmCheck struct {
+	OpenshiftEngine cli.OpenshiftEngine
+}
 
-func (p *DeployableByOlmCheck) Validate(bundleRef certification.ImageReference) (bool, error) {
+var (
+	subscriptionTimeout time.Duration = 180
+	csvTimeout          time.Duration = 90
+)
 
-	// create a new instance of openshift engine
-	openshiftEngine, err := p.newOpenshiftEngine()
-	if err != nil {
-		return false, err
+func NewDeployableByOlmCheck(openshiftEngine *cli.OpenshiftEngine) *DeployableByOlmCheck {
+	return &DeployableByOlmCheck{
+		OpenshiftEngine: *openshiftEngine,
 	}
+}
 
+func (p *DeployableByOlmCheck) Validate(bundleRef certification.ImageReference) (bool, error) {
 	// retrieve the required data
 	operatorData, err := p.operatorMetadata(bundleRef)
 	if err != nil {
 		return false, err
 	}
 
-	// create k8s custom resources for the operator deployment
-	err = p.setUp(*operatorData, *openshiftEngine)
-	defer p.cleanUp(*operatorData, *openshiftEngine)
-
+	err = p.OpenshiftEngine.Setup()
 	if err != nil {
 		return false, err
 	}
 
-	installedCSV, err := p.installedCSV(*operatorData, *openshiftEngine)
+	// create k8s custom resources for the operator deployment
+	err = p.setUp(*operatorData)
+	defer p.cleanUp(*operatorData)
+
 	if err != nil {
 		return false, err
 	}
 
-	return p.isCSVReady(installedCSV, *operatorData, *openshiftEngine)
-}
-
-func (p *DeployableByOlmCheck) newOpenshiftEngine() (*openshiftengine.OpenshiftEngine, error) {
-	k8sconfig, err := clientcmd.BuildConfigFromFlags("", os.Getenv("KUBECONFIG"))
+	installedCSV, err := p.installedCSV(*operatorData)
 	if err != nil {
-		log.Error("unable to create a kubernetes client: ", err)
-		return nil, err
+		return false, err
 	}
 
-	return &openshiftengine.OpenshiftEngine{
-		KubeConfig: k8sconfig,
-	}, nil
+	return p.isCSVReady(installedCSV, *operatorData)
 }
 
 func (p *DeployableByOlmCheck) operatorMetadata(bundleRef certification.ImageReference) (*OperatorData, error) {
@@ -109,18 +106,18 @@ func (p *DeployableByOlmCheck) operatorMetadata(bundleRef certification.ImageRef
 	}, nil
 }
 
-func (p *DeployableByOlmCheck) setUp(operatorData OperatorData, openshiftengine openshiftengine.OpenshiftEngine) error {
+func (p *DeployableByOlmCheck) setUp(operatorData OperatorData) error {
 
-	if _, err := openshiftengine.CreateNamespace(operatorData.InstallNamespace, cli.OpenshiftOptions{}); err != nil && !kubeErr.IsAlreadyExists(err) {
+	if _, err := p.OpenshiftEngine.CreateNamespace(operatorData.InstallNamespace, cli.OpenshiftOptions{}); err != nil && !kubeErr.IsAlreadyExists(err) {
 		return err
 	}
 
-	if _, err := openshiftengine.CreateCatalogSource(cli.CatalogSourceData{Name: operatorData.App, Image: operatorData.CatalogImage}, cli.OpenshiftOptions{Namespace: catalogSourceNS}); err != nil && !kubeErr.IsAlreadyExists(err) {
+	if _, err := p.OpenshiftEngine.CreateCatalogSource(cli.CatalogSourceData{Name: operatorData.App, Image: operatorData.CatalogImage}, cli.OpenshiftOptions{Namespace: catalogSourceNS}); err != nil && !kubeErr.IsAlreadyExists(err) {
 		return err
 	}
 
 	targetNamespaces := []string{operatorData.InstallNamespace}
-	if _, err := openshiftengine.CreateOperatorGroup(cli.OperatorGroupData{Name: operatorData.App, TargetNamespaces: targetNamespaces}, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
+	if _, err := p.OpenshiftEngine.CreateOperatorGroup(cli.OperatorGroupData{Name: operatorData.App, TargetNamespaces: targetNamespaces}, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
 		return err
 	}
 
@@ -131,13 +128,13 @@ func (p *DeployableByOlmCheck) setUp(operatorData OperatorData, openshiftengine
 		CatalogSourceNamespace: catalogSourceNS,
 		Package:                operatorData.PackageName,
 	}
-	if _, err := openshiftengine.CreateSubscription(subscriptionData, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
+	if _, err := p.OpenshiftEngine.CreateSubscription(subscriptionData, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace}); err != nil && !kubeErr.IsAlreadyExists(err) {
 		return err
 	}
 	return nil
 }
 
-func (p *DeployableByOlmCheck) isCSVReady(installedCSV string, operatorData OperatorData, openshiftengine openshiftengine.OpenshiftEngine) (bool, error) {
+func (p *DeployableByOlmCheck) isCSVReady(installedCSV string, operatorData OperatorData) (bool, error) {
 
 	log.Trace(fmt.Sprintf("Looking for csv %s in namespace %s", installedCSV, operatorData.InstallNamespace))
 
@@ -150,12 +147,12 @@ func (p *DeployableByOlmCheck) isCSVReady(installedCSV string, operatorData Oper
 	defer close(contextTimeOut)
 
 	go func(parent context.Context) {
-		ctx, cancel := context.WithTimeout(parent, 90*time.Second)
+		ctx, cancel := context.WithTimeout(parent, csvTimeout)
 		defer cancel()
 
 		for {
 			log.Debug("Waiting for ClusterServiceVersion to become ready...")
-			csv, _ := openshiftengine.GetCSV(installedCSV, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+			csv, _ := p.OpenshiftEngine.GetCSV(installedCSV, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
 			// if the CSV phase is succeeded, stop the querying
 			if csv.Status.Phase == operatorv1alpha1.CSVPhaseSucceeded {
 				log.Debug("CSV is created successfully: ", installedCSV)
@@ -184,7 +181,7 @@ func (p *DeployableByOlmCheck) isCSVReady(installedCSV string, operatorData Oper
 
 }
 
-func (p *DeployableByOlmCheck) installedCSV(operatorData OperatorData, openshiftengine openshiftengine.OpenshiftEngine) (string, error) {
+func (p *DeployableByOlmCheck) installedCSV(operatorData OperatorData) (string, error) {
 
 	ctx := context.Background()
 
@@ -196,12 +193,11 @@ func (p *DeployableByOlmCheck) installedCSV(operatorData OperatorData, openshift
 
 	// query API server for the installed CSV field of the created subscription
 	go func(parent context.Context) {
-		ctx, cancel := context.WithTimeout(parent, 180*time.Second)
+		ctx, cancel := context.WithTimeout(parent, subscriptionTimeout)
 		defer cancel()
-
 		for {
 			log.Debug("Waiting for Subscription.status.installedCSV to become ready...")
-			subs, _ := openshiftengine.GetSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+			subs, _ := p.OpenshiftEngine.GetSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
 			installedCSV := subs.Status.InstalledCSV
 			// if the installedCSV field is present, stop the querying
 			if len(installedCSV) > 0 {
@@ -230,51 +226,54 @@ func (p *DeployableByOlmCheck) installedCSV(operatorData OperatorData, openshift
 	}
 }
 
-func (p *DeployableByOlmCheck) cleanUp(operatorData OperatorData, openshiftengine openshiftengine.OpenshiftEngine) {
+func (p *DeployableByOlmCheck) cleanUp(operatorData OperatorData) {
 
 	log.Debug("Dumping data in artifacts/ directory")
 
-	subs, err := openshiftengine.GetSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+	subs, err := p.OpenshiftEngine.GetSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
 	if err != nil {
 		log.Error("unable to retrieve the subscription")
 	}
 	p.writeToFile(subs, operatorData.App, "subscription")
 
-	cs, err := openshiftengine.GetCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
+	cs, err := p.OpenshiftEngine.GetCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
 	if err != nil {
 		log.Error("unable to retrieve the catalogsource")
 	}
 	p.writeToFile(cs, operatorData.App, "catalogsource")
 
-	og, err := openshiftengine.GetOperatorGroup(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+	og, err := p.OpenshiftEngine.GetOperatorGroup(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
 	if err != nil {
 		log.Error("unable to retrieve the operatorgroup")
 	}
 	p.writeToFile(og, operatorData.App, "operatorgroup")
 
-	ns, err := openshiftengine.GetNamespace(operatorData.InstallNamespace)
+	ns, err := p.OpenshiftEngine.GetNamespace(operatorData.InstallNamespace)
 	if err != nil {
 		log.Error("unable to retrieve the namespace")
 	}
 	p.writeToFile(ns, operatorData.InstallNamespace, "namespace")
 
 	log.Trace("Deleting the resources created by Check")
-	openshiftengine.DeleteSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
-	openshiftengine.DeleteCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
-	openshiftengine.DeleteOperatorGroup(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
-	openshiftengine.DeleteNamespace(operatorData.InstallNamespace, cli.OpenshiftOptions{})
+	p.OpenshiftEngine.DeleteSubscription(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+	p.OpenshiftEngine.DeleteCatalogSource(operatorData.App, cli.OpenshiftOptions{Namespace: catalogSourceNS})
+	p.OpenshiftEngine.DeleteOperatorGroup(operatorData.App, cli.OpenshiftOptions{Namespace: operatorData.InstallNamespace})
+	p.OpenshiftEngine.DeleteNamespace(operatorData.InstallNamespace, cli.OpenshiftOptions{})
 }
 
-func (p *DeployableByOlmCheck) writeToFile(data interface{}, resource string, resourceType string) {
+func (p *DeployableByOlmCheck) writeToFile(data interface{}, resource string, resourceType string) error {
 	yamlData, err := yaml.Marshal(data)
 	if err != nil {
 		log.Error("unable to serialize the data")
+		return err
 	}
 
 	filename := fmt.Sprintf("%s-%s.yaml", resource, resourceType)
 	if _, err := artifacts.WriteFile(filename, string(yamlData)); err != nil {
 		log.Error("failed to write the k8s object to the file", err)
+		return err
 	}
+	return nil
 }
 
 func (p *DeployableByOlmCheck) Name() string {


Test patch:
diff --git a/certification/internal/policy/operator/deployable_by_olm_test.go b/certification/internal/policy/operator/deployable_by_olm_test.go
new file mode 100644
index 0000000..7233e07
--- /dev/null
+++ b/certification/internal/policy/operator/deployable_by_olm_test.go
@@ -0,0 +1,82 @@
+package operator
+
+import (
+	"os"
+	"path/filepath"
+
+	fakecranev1 "github.com/google/go-containerregistry/pkg/v1/fake"
+	. "github.com/onsi/ginkgo"
+	. "github.com/onsi/gomega"
+	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
+	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
+)
+
+var _ = Describe("DeployableByOLMCheck", func() {
+	var (
+		deployableByOLMCheck DeployableByOlmCheck
+		engine               cli.OpenshiftEngine
+		imageRef             certification.ImageReference
+	)
+	const (
+		metadataDir        = "metadata"
+		annotationFilename = "annotations.yaml"
+		annotations        = `annotations:
+  operators.operatorframework.io.bundle.package.v1: testPackage
+  operators.operatorframework.io.bundle.channel.default.v1: testChannel
+`
+	)
+	BeforeEach(func() {
+		// override default timeout
+		subscriptionTimeout = 1
+		csvTimeout = 1
+
+		// mock bundle directory
+		tmpDir, err := os.MkdirTemp("", "bundle-metadata-*")
+		Expect(err).ToNot(HaveOccurred())
+
+		err = os.Mkdir(filepath.Join(tmpDir, metadataDir), 0755)
+		Expect(err).ToNot(HaveOccurred())
+
+		err = os.WriteFile(filepath.Join(tmpDir, metadataDir, annotationFilename), []byte(annotations), 0644)
+		Expect(err).ToNot(HaveOccurred())
+
+		fakeImage := fakecranev1.FakeImage{}
+		imageRef.ImageInfo = &fakeImage
+		imageRef.ImageFSPath = tmpDir
+
+		// set env var for index image
+		os.Setenv("PFLT_INDEXIMAGE", "test_indeximage")
+		os.Setenv("PFLT_ARTIFACTS", tmpDir)
+	})
+	Describe("When deploying an operator using OLM", func() {
+		Context("When CSV has been created successfully", func() {
+			BeforeEach(func() {
+				engine = FakeOpenshiftEngine{}
+				deployableByOLMCheck = *NewDeployableByOlmCheck(&engine)
+			})
+
+			It("Should pass Validate", func() {
+				ok, err := deployableByOLMCheck.Validate(imageRef)
+				Expect(err).ToNot(HaveOccurred())
+				Expect(ok).To(BeTrue())
+			})
+		})
+		Context("When installedCSV field of Subscription is not set", func() {
+			BeforeEach(func() {
+				engine = BadOpenshiftEngine{}
+				deployableByOLMCheck = *NewDeployableByOlmCheck(&engine)
+			})
+
+			It("Should fail Validate", func() {
+				ok, err := deployableByOLMCheck.Validate(imageRef)
+				Expect(err).To(HaveOccurred())
+				Expect(ok).To(BeFalse())
+			})
+		})
+	})
+	AfterEach(func() {
+		err := os.RemoveAll(imageRef.ImageFSPath)
+		Expect(err).ToNot(HaveOccurred())
+
+	})
+})
diff --git a/certification/internal/policy/operator/operator_suite_test.go b/certification/internal/policy/operator/operator_suite_test.go
index 66d7a59..dcb1d5d 100644
--- a/certification/internal/policy/operator/operator_suite_test.go
+++ b/certification/internal/policy/operator/operator_suite_test.go
@@ -6,8 +6,13 @@ import (
 
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
+	operatorv1 "github.com/operator-framework/api/pkg/operators/v1"
+	operatorv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
 	log "github.com/sirupsen/logrus"
+	"github.com/spf13/viper"
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
 func TestOperator(t *testing.T) {
@@ -18,6 +23,9 @@ func TestOperator(t *testing.T) {
 func init() {
 	log.SetFormatter(&log.TextFormatter{})
 	log.SetLevel(log.TraceLevel)
+
+	viper.SetEnvPrefix("pflt")
+	viper.AutomaticEnv()
 }
 
 type FakeOperatorSdkEngine struct {
@@ -53,3 +61,248 @@ func (bose BadOperatorSdkEngine) BundleValidate(bundleImage string, opts cli.Ope
 	}
 	return &operatorSdkReport, errors.New("the Operator Sdk Bundle Validate has failed")
 }
+
+type FakeOpenshiftEngine struct{}
+
+func (foe FakeOpenshiftEngine) Setup() error {
+	return nil
+}
+
+func (foe FakeOpenshiftEngine) CreateNamespace(name string, opts cli.OpenshiftOptions) (*corev1.Namespace, error) {
+	return &corev1.Namespace{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "test-ns",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) DeleteNamespace(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe FakeOpenshiftEngine) GetNamespace(name string) (*corev1.Namespace, error) {
+	return &corev1.Namespace{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "test-ns",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) CreateOperatorGroup(data cli.OperatorGroupData, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
+	return &operatorv1.OperatorGroup{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-og",
+			Namespace: "test-ns",
+		},
+		Spec: operatorv1.OperatorGroupSpec{
+			TargetNamespaces: []string{"test-ns"},
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) DeleteOperatorGroup(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe FakeOpenshiftEngine) GetOperatorGroup(name string, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
+	return &operatorv1.OperatorGroup{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-og",
+			Namespace: "test-ns",
+		},
+		Spec: operatorv1.OperatorGroupSpec{
+			TargetNamespaces: []string{"test-ns"},
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) CreateCatalogSource(data cli.CatalogSourceData, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
+	return &operatorv1alpha1.CatalogSource{
+		Spec: operatorv1alpha1.CatalogSourceSpec{
+			SourceType: operatorv1alpha1.SourceTypeGrpc,
+			Image:      "indexImageUri",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) DeleteCatalogSource(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe FakeOpenshiftEngine) GetCatalogSource(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
+	return &operatorv1alpha1.CatalogSource{
+		Spec: operatorv1alpha1.CatalogSourceSpec{
+			SourceType: operatorv1alpha1.SourceTypeGrpc,
+			Image:      "indexImageUri",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) CreateSubscription(data cli.SubscriptionData, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
+	return &operatorv1alpha1.Subscription{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-sub",
+			Namespace: "test-ns",
+		},
+		Spec: &operatorv1alpha1.SubscriptionSpec{
+			CatalogSource:          "test-cs",
+			CatalogSourceNamespace: "openshift-marketplace",
+			Channel:                "stable",
+			Package:                "test-operator",
+		},
+		Status: operatorv1alpha1.SubscriptionStatus{
+			InstalledCSV: "csv-v0.0.0",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) DeleteSubscription(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe FakeOpenshiftEngine) GetSubscription(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
+	return &operatorv1alpha1.Subscription{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-sub",
+			Namespace: "test-ns",
+		},
+		Spec: &operatorv1alpha1.SubscriptionSpec{
+			CatalogSource:          "test-cs",
+			CatalogSourceNamespace: "openshift-marketplace",
+			Channel:                "stable",
+			Package:                "test-operator",
+		},
+		Status: operatorv1alpha1.SubscriptionStatus{
+			InstalledCSV: "csv-v0.0.0",
+		},
+	}, nil
+}
+
+func (foe FakeOpenshiftEngine) GetCSV(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.ClusterServiceVersion, error) {
+	return &operatorv1alpha1.ClusterServiceVersion{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "csv-v0.0.0",
+			Namespace: "test-ns",
+		},
+		Spec: operatorv1alpha1.ClusterServiceVersionSpec{},
+		Status: operatorv1alpha1.ClusterServiceVersionStatus{
+			Phase: operatorv1alpha1.CSVPhaseSucceeded,
+		},
+	}, nil
+}
+
+type BadOpenshiftEngine struct{}
+
+func (foe BadOpenshiftEngine) Setup() error {
+	return nil
+}
+
+func (foe BadOpenshiftEngine) CreateNamespace(name string, opts cli.OpenshiftOptions) (*corev1.Namespace, error) {
+	return &corev1.Namespace{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "test-ns",
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) DeleteNamespace(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe BadOpenshiftEngine) GetNamespace(name string) (*corev1.Namespace, error) {
+	return &corev1.Namespace{
+		ObjectMeta: metav1.ObjectMeta{
+			Name: "test-ns",
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) CreateOperatorGroup(data cli.OperatorGroupData, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
+	return &operatorv1.OperatorGroup{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-og",
+			Namespace: "test-ns",
+		},
+		Spec: operatorv1.OperatorGroupSpec{
+			TargetNamespaces: []string{"test-ns"},
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) DeleteOperatorGroup(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe BadOpenshiftEngine) GetOperatorGroup(name string, opts cli.OpenshiftOptions) (*operatorv1.OperatorGroup, error) {
+	return &operatorv1.OperatorGroup{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-og",
+			Namespace: "test-ns",
+		},
+		Spec: operatorv1.OperatorGroupSpec{
+			TargetNamespaces: []string{"test-ns"},
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) CreateCatalogSource(data cli.CatalogSourceData, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
+	return &operatorv1alpha1.CatalogSource{
+		Spec: operatorv1alpha1.CatalogSourceSpec{
+			SourceType: operatorv1alpha1.SourceTypeGrpc,
+			Image:      "indexImageUri",
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) DeleteCatalogSource(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe BadOpenshiftEngine) GetCatalogSource(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.CatalogSource, error) {
+	return &operatorv1alpha1.CatalogSource{
+		Spec: operatorv1alpha1.CatalogSourceSpec{
+			SourceType: operatorv1alpha1.SourceTypeGrpc,
+			Image:      "indexImageUri",
+		},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) CreateSubscription(data cli.SubscriptionData, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
+	return &operatorv1alpha1.Subscription{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-sub",
+			Namespace: "test-ns",
+		},
+		Spec: &operatorv1alpha1.SubscriptionSpec{
+			CatalogSource:          "test-cs",
+			CatalogSourceNamespace: "openshift-marketplace",
+			Channel:                "stable",
+			Package:                "test-operator",
+		},
+		Status: operatorv1alpha1.SubscriptionStatus{},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) DeleteSubscription(name string, opts cli.OpenshiftOptions) error {
+	return nil
+}
+
+func (foe BadOpenshiftEngine) GetSubscription(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.Subscription, error) {
+	return &operatorv1alpha1.Subscription{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "test-sub",
+			Namespace: "test-ns",
+		},
+		Spec: &operatorv1alpha1.SubscriptionSpec{
+			CatalogSource:          "test-cs",
+			CatalogSourceNamespace: "openshift-marketplace",
+			Channel:                "stable",
+			Package:                "test-operator",
+		},
+		Status: operatorv1alpha1.SubscriptionStatus{},
+	}, nil
+}
+
+func (foe BadOpenshiftEngine) GetCSV(name string, opts cli.OpenshiftOptions) (*operatorv1alpha1.ClusterServiceVersion, error) {
+	return nil, nil
+}