Repository: redhat-openshift-ecosystem/openshift-preflight
Pull request #418 (2022-02-16 20:22:48)

refactoring to make project id and api token required flags
- Fixes: #416 
- making flags various flags required
- Fixed linter issue

Signed-off-by: Adam D. Cornett <adc@redhat.com>


Patch:
diff --git a/certification/defaults.go b/certification/defaults.go
index 048614c..d8057d3 100644
--- a/certification/defaults.go
+++ b/certification/defaults.go
@@ -4,5 +4,4 @@ var (
 	DefaultCertImageFilename   = "cert-image.json"
 	DefaultRPMManifestFilename = "rpm-manifest.json"
 	DefaultTestResultsFilename = "results.json"
-	SystemdDir                 = "/etc/systemd/system"
 )
diff --git a/certification/engine/engine.go b/certification/engine/engine.go
index 2aec3ab..08df0a4 100644
--- a/certification/engine/engine.go
+++ b/certification/engine/engine.go
@@ -87,7 +87,6 @@ var hasRequiredLabelsCheck certification.Check = &containerpol.HasRequiredLabels
 var runAsRootCheck certification.Check = &containerpol.RunAsNonRootCheck{}
 var basedOnUbiCheck certification.Check = &containerpol.BasedOnUBICheck{}
 var runnableContainerCheck certification.Check = containerpol.NewRunnableContainerCheck(internal.NewPodmanEngine())
-var runSystemContainerCheck certification.Check = containerpol.NewRunSystemContainerCheck(internal.NewPodmanEngine())
 
 var operatorPolicy = map[string]certification.Check{
 	//operatorPkgNameIsUniqueCheck.Name(): operatorPkgNameIsUniqueCheck,
@@ -98,15 +97,14 @@ var operatorPolicy = map[string]certification.Check{
 }
 
 var containerPolicy = map[string]certification.Check{
-	hasLicenseCheck.Name():         hasLicenseCheck,
-	hasUniqueTagCheck.Name():       hasUniqueTagCheck,
-	maxLayersCheck.Name():          maxLayersCheck,
-	hasNoProhibitedCheck.Name():    hasNoProhibitedCheck,
-	hasRequiredLabelsCheck.Name():  hasRequiredLabelsCheck,
-	runAsRootCheck.Name():          runAsRootCheck,
-	basedOnUbiCheck.Name():         basedOnUbiCheck,
-	runnableContainerCheck.Name():  runnableContainerCheck,
-	runSystemContainerCheck.Name(): runSystemContainerCheck,
+	hasLicenseCheck.Name():        hasLicenseCheck,
+	hasUniqueTagCheck.Name():      hasUniqueTagCheck,
+	maxLayersCheck.Name():         maxLayersCheck,
+	hasNoProhibitedCheck.Name():   hasNoProhibitedCheck,
+	hasRequiredLabelsCheck.Name(): hasRequiredLabelsCheck,
+	runAsRootCheck.Name():         runAsRootCheck,
+	basedOnUbiCheck.Name():        basedOnUbiCheck,
+	runnableContainerCheck.Name(): runnableContainerCheck,
 }
 
 var scratchContainerPolicy = map[string]certification.Check{
diff --git a/certification/internal/cli/podman.go b/certification/internal/cli/podman.go
index 808d2e5..e10a299 100644
--- a/certification/internal/cli/podman.go
+++ b/certification/internal/cli/podman.go
@@ -14,9 +14,8 @@ type PodmanOutput struct {
 }
 
 type PodmanCreateOption struct {
-	Entrypoint    []string
-	Cmd           []string
-	ContainerName string
+	Entrypoint []string
+	Cmd        []string
 }
 
 type ImagePullOptions struct {
@@ -40,11 +39,9 @@ type InspectContainerConfig struct {
 }
 
 type PodmanEngine interface {
+	PullImage(imageURI string, options ImagePullOptions) (*PodmanOutput, error)
 	CreateContainer(imageURI string, createOptions PodmanCreateOption) (*PodmanCreateOutput, error)
 	StartContainer(nameOrId string) (*PodmanOutput, error)
 	RemoveContainer(containerId string) error
 	WaitContainer(containerId string, waitOptions WaitOptions) (bool, error)
-	RunSystemContainer(containerName string) (*PodmanOutput, error)
-	IsSystemContainerRunning(serviceName string) (bool, error)
-	StopSystemContainer(serviceName string) error
 }
diff --git a/certification/internal/engine/podman.go b/certification/internal/engine/podman.go
index 22290b8..6e3064d 100644
--- a/certification/internal/engine/podman.go
+++ b/certification/internal/engine/podman.go
@@ -4,20 +4,13 @@ import (
 	"bytes"
 	"context"
 	"fmt"
-	"os"
-	exec "os/exec"
-	"regexp"
+	"os/exec"
 	"strings"
 
-	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
 	log "github.com/sirupsen/logrus"
 )
 
-const (
-	runAsPrivileged = true
-)
-
 type podmanEngine struct{}
 
 func NewPodmanEngine() *cli.PodmanEngine {
@@ -25,18 +18,52 @@ func NewPodmanEngine() *cli.PodmanEngine {
 	return &engine
 }
 
+func (p *podmanEngine) PullImage(imageURI string, options cli.ImagePullOptions) (*cli.PodmanOutput, error) {
+	log.Debug(fmt.Sprintf("Pulling image %s from repository", imageURI))
+	cmdArgs := []string{"pull"}
+
+	if options.Quiet {
+		cmdArgs = append(cmdArgs, "--quiet")
+	}
+
+	cmdArgs = append(cmdArgs, imageURI)
+
+	cmd := exec.Command("podman", cmdArgs...)
+
+	log.Debugf("Command being run: %+v", cmd)
+
+	var stdout, stderr bytes.Buffer
+	cmd.Stdout = &stdout
+	cmd.Stderr = &stderr
+
+	if err := cmd.Run(); err != nil {
+		log.Error(fmt.Sprintf("unable to pull image %s: ", imageURI), err)
+		log.Error("Stderr: ", stderr.String())
+		return &cli.PodmanOutput{
+			Stderr: stderr.String(),
+		}, err
+	}
+	log.Debug(fmt.Sprintf("Successfully pulled image %s from repository", imageURI))
+	return &cli.PodmanOutput{
+		Stdout: stdout.String(),
+	}, nil
+}
+
 func (p *podmanEngine) CreateContainer(imageURI string, createOptions cli.PodmanCreateOption) (*cli.PodmanCreateOutput, error) {
 	log.Debug(fmt.Sprintf("Creating container %s with the run options: %+v", imageURI, createOptions))
 
+	if _, err := p.PullImage(imageURI, cli.ImagePullOptions{Quiet: true}); err != nil {
+		return nil, err
+	}
 	cmdArgs := []string{"create"}
+
 	if len(createOptions.Entrypoint) > 0 {
 		cmdArgs = append(cmdArgs, "--entrypoint")
 		cmdArgs = append(cmdArgs, createOptions.Entrypoint...)
 	}
-	if len(createOptions.ContainerName) > 0 {
-		cmdArgs = append(cmdArgs, "--name", createOptions.ContainerName)
-	}
+
 	cmdArgs = append(cmdArgs, imageURI)
+
 	if len(createOptions.Cmd) > 0 {
 		cmdArgs = append(cmdArgs, createOptions.Cmd...)
 	}
@@ -107,7 +134,8 @@ func (p *podmanEngine) RemoveContainer(containerId string) error {
 	cmd.Stdout = &stdout
 	cmd.Stderr = &stderr
 	if err := cmd.Run(); err != nil {
-		log.Debug("Stderr: ", stderr.String())
+		log.Error(fmt.Sprintf("unable to remove container %s: ", containerId), err)
+		log.Error("Stderr: ", stderr.String())
 		return err
 	}
 	return nil
@@ -149,133 +177,3 @@ func (p *podmanEngine) WaitContainer(containerId string, waitOptions cli.WaitOpt
 	log.Info("container reached a running state")
 	return true, nil
 }
-
-func (p *podmanEngine) RunSystemContainer(containerName string) (*cli.PodmanOutput, error) {
-	log.Debug(fmt.Sprintf("Generating Systemd file for container %s", containerName))
-	cmdArgs := []string{"generate", "systemd", "--new", "--files", "--name", containerName}
-
-	output, err := RunCommand(!runAsPrivileged, "podman", cmdArgs)
-
-	if err != nil {
-		return output, err
-	}
-	serviceFilepath := strings.TrimSpace(output.Stdout)
-
-	r, err := regexp.Compile(".*/(.+.service)")
-	if err != nil {
-		log.Error("unable to fetch the name of the systemd service: ", err)
-		return &cli.PodmanOutput{
-			Stderr: err.Error(),
-		}, err
-	}
-	serviceName := r.FindStringSubmatch(serviceFilepath)[1]
-
-	// copy the unit file from working dir to systemd dir
-	_, err = copyFile(runAsPrivileged, serviceFilepath, certification.SystemdDir)
-	defer os.Remove(serviceFilepath)
-
-	if err != nil {
-		log.Error(fmt.Sprintf("unable to copy the unit file into the systemd dir %s: ", certification.SystemdDir), err)
-		return &cli.PodmanOutput{
-			Stderr: err.Error(),
-		}, err
-	}
-
-	log.Debug(fmt.Sprintf("Reloading daemon set and start the service %s", serviceName))
-
-	if output, err = RunCommand(runAsPrivileged, "systemctl", []string{"daemon-reload"}); err != nil {
-		log.Error("unable to reaload the daemon set: ", err)
-		log.Error("Stderr: ", output.Stderr)
-		// remove the service file
-		RunCommand(runAsPrivileged, "rm", []string{"-f", fmt.Sprintf("%s/%s", certification.SystemdDir, serviceName)})
-
-		return &cli.PodmanOutput{
-			Stderr: output.Stderr,
-		}, err
-	}
-	if output, err = RunCommand(runAsPrivileged, "systemctl", []string{"start", serviceName}); err != nil {
-		log.Error(fmt.Sprintf("unable to start the service %s: ", serviceName), err)
-		log.Error("Stderr: ", output.Stderr)
-		// remove the service file
-		RunCommand(runAsPrivileged, "rm", []string{"-f", fmt.Sprintf("%s/%s", certification.SystemdDir, serviceName)})
-
-		return &cli.PodmanOutput{
-			Stderr: output.Stderr,
-		}, err
-	}
-
-	return &cli.PodmanOutput{
-		Stdout: serviceName,
-	}, nil
-}
-
-func (p *podmanEngine) IsSystemContainerRunning(serviceName string) (bool, error) {
-	log.Debug("Checking the service status of ", serviceName)
-
-	output, err := RunCommand(runAsPrivileged, "systemctl", []string{"is-active", serviceName})
-	if err != nil {
-		log.Error(fmt.Sprintf("unable to check the status of the service %s: ", serviceName), err)
-		log.Error("Stderr: ", output.Stderr)
-		return false, err
-	}
-	serviceStatus := strings.TrimSpace(output.Stdout)
-	log.Debug(fmt.Sprintf("The %s status is %s", serviceName, serviceStatus))
-	return strings.ToLower(serviceStatus) == "active", nil
-}
-
-func (p *podmanEngine) StopSystemContainer(serviceName string) error {
-	log.Debug("Stopping the container service ", serviceName)
-
-	if output, err := RunCommand(runAsPrivileged, "systemctl", []string{"stop", serviceName}); err != nil {
-		log.Error(fmt.Sprintf("unable to start the service %s: ", serviceName), err)
-		log.Error("Stderr: ", output.Stderr)
-		return err
-	}
-
-	if output, err := RunCommand(runAsPrivileged, "systemctl", []string{"daemon-reload"}); err != nil {
-		log.Error("unable to reaload the daemon set: ", err)
-		log.Error("Stderr: ", output.Stderr)
-		return err
-	}
-	log.Debug("Successfully stopped the container service ", serviceName)
-	return nil
-}
-
-func copyFile(isPrivileged bool, src string, dst string) (int64, error) {
-	log.Debug(fmt.Sprintf("Copying %s into %s", src, dst))
-
-	if _, err := RunCommand(isPrivileged, "cp", []string{src, dst}); err != nil {
-		log.Error(fmt.Sprintf("failed to copy %s to %s", src, dst))
-		return -1, err
-	}
-	log.Debug(fmt.Sprintf("Successfully copied %s to %s", src, dst))
-	return 0, nil
-}
-
-func RunCommand(isPrivileged bool, command string, args []string) (*cli.PodmanOutput, error) {
-	var cmd *exec.Cmd
-
-	if isPrivileged {
-		cmdArgs := "sudo " + command + " " + strings.Join(args, " ")
-		cmd = exec.Command("sh", "-c", cmdArgs)
-	} else {
-		cmd = exec.Command(command, args...)
-	}
-
-	log.Debugf("Command being run: %+v", cmd)
-
-	var stdout, stderr bytes.Buffer
-	cmd.Stdout = &stdout
-	cmd.Stderr = &stderr
-
-	if err := cmd.Run(); err != nil {
-		log.Error(fmt.Sprintf("unable to run command %+v ", command), err)
-		log.Error("Stderr: ", stderr.String())
-		return &cli.PodmanOutput{
-			Stderr: stderr.String(),
-		}, err
-	}
-	return &cli.PodmanOutput{
-		Stdout: stdout.String(),
-	}, nil
-}
diff --git a/certification/internal/policy/container/run_system_container.go b/certification/internal/policy/container/run_system_container.go
deleted file mode 100644
index 1e7e18a..0000000
--- a/certification/internal/policy/container/run_system_container.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package container
-
-import (
-	"fmt"
-	"os"
-
-	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
-	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
-	log "github.com/sirupsen/logrus"
-)
-
-// RunSystemContainerCheck runs a container as a systemd service
-// and ensures that the service is up and running.
-type RunSystemContainerCheck struct {
-	PodmanEngine cli.PodmanEngine
-}
-
-func NewRunSystemContainerCheck(podmanEngine *cli.PodmanEngine) *RunSystemContainerCheck {
-	return &RunSystemContainerCheck{
-		PodmanEngine: *podmanEngine,
-	}
-}
-
-func (p *RunSystemContainerCheck) Validate(imgRef certification.ImageReference) (bool, error) {
-	containerName := "podman-test"
-
-	runOptions := &cli.PodmanCreateOption{
-		ContainerName: containerName,
-	}
-
-	createOutput, err := p.PodmanEngine.CreateContainer(imgRef.ImageURI, *runOptions)
-	if err != nil {
-		return false, err
-	}
-	defer func() {
-		if err := p.PodmanEngine.RemoveContainer(containerName); err != nil {
-			log.Warn(fmt.Sprintf("unable to remove container %s: ", createOutput.ContainerId), err)
-		}
-	}()
-
-	podmanOutput, err := p.PodmanEngine.RunSystemContainer(containerName)
-	if err != nil {
-		return false, err
-	}
-
-	serviceName := podmanOutput.Stdout
-	defer func() {
-		if err := p.PodmanEngine.StopSystemContainer(serviceName); err != nil {
-			log.Warn(fmt.Sprintf("unable to stop service %s: ", serviceName), err)
-		}
-		os.Remove(fmt.Sprintf("%s/%s", certification.SystemdDir, serviceName))
-	}()
-
-	status, err := p.PodmanEngine.IsSystemContainerRunning(serviceName)
-	if err != nil {
-		return false, err
-	}
-
-	return status, nil
-}
-
-func (p *RunSystemContainerCheck) Name() string {
-	return "RunSystemContainer"
-}
-
-func (p *RunSystemContainerCheck) Metadata() certification.Metadata {
-	return certification.Metadata{
-		Description:      "Checking if a container can run as a systemd service",
-		Level:            "best",
-		KnowledgeBaseURL: "https://connect.redhat.com/zones/containers/container-certification-policy-guide",
-		CheckURL:         "https://connect.redhat.com/zones/containers/container-certification-policy-guide",
-	}
-}
-
-func (p *RunSystemContainerCheck) Help() certification.HelpText {
-	return certification.HelpText{
-		Message:    "Check RunSystemContainer encountered an error. Please review the preflight.log file for more information.",
-		Suggestion: "Ensure that the container can be launched as a systemd service",
-	}
-}
diff --git a/cmd/check_container.go b/cmd/check_container.go
index 0b06ba9..bb4308e 100644
--- a/cmd/check_container.go
+++ b/cmd/check_container.go
@@ -25,14 +25,16 @@ import (
 	"github.com/spf13/viper"
 )
 
+var submit bool
+
 var checkContainerCmd = &cobra.Command{
 	Use:   "container",
 	Short: "Run checks for a container",
 	Long:  `This command will run the Certification checks for a container image. `,
 	Args: func(cmd *cobra.Command, args []string) error {
 		if l, _ := cmd.Flags().GetBool("list-checks"); l {
-			fmt.Println(fmt.Sprintf("\n%s\n%s%s", "The checks that will be executed are the following:", "- ",
-				strings.Join(engine.ContainerPolicy(), "\n- ")))
+			fmt.Printf("\n%s\n%s%s\n", "The checks that will be executed are the following:", "- ",
+				strings.Join(engine.ContainerPolicy(), "\n- "))
 
 			// exiting gracefully instead of retuning, otherwise cobra calls RunE
 			os.Exit(0)
@@ -42,16 +44,8 @@ var checkContainerCmd = &cobra.Command{
 			return fmt.Errorf("%w: A container image positional argument is required", errors.ErrInsufficientPosArguments)
 		}
 
-		if s, _ := cmd.Flags().GetBool("submit"); s {
-			if d, _ := cmd.Flags().GetString("docker-config"); len(d) == 0 {
-				return fmt.Errorf("%w: A docker configuration file must be present when calling --submit", errors.ErrNoDockerConfig)
-			}
-			if p, _ := cmd.Flags().GetString("pyxis-api-token"); len(p) == 0 {
-				return fmt.Errorf("%w: A Pyxis API token must be present when calling --submit", errors.ErrNoPyxisAPIKey)
-			}
-			if p, _ := cmd.Flags().GetString("certification-project-id"); len(p) == 0 {
-				return fmt.Errorf("%w: A Certification Project ID must be present when calling --submit", errors.ErrEmptyProjectID)
-			}
+		if submit {
+			cmd.MarkFlagRequired("docker-config")
 		}
 
 		return nil
@@ -210,19 +204,21 @@ var checkContainerCmd = &cobra.Command{
 }
 
 func init() {
-	checkContainerCmd.Flags().BoolP("submit", "s", false, "submit check container results to red hat")
+	checkContainerCmd.Flags().BoolVarP(&submit, "submit", "s", false, "submit check container results to red hat")
 	viper.BindPFlag("submit", checkContainerCmd.Flags().Lookup("submit"))
 
 	checkContainerCmd.Flags().StringP("docker-config", "d", "", "path to docker config.json file")
 	viper.BindPFlag("docker_config", checkContainerCmd.Flags().Lookup("docker-config"))
 
 	checkContainerCmd.Flags().String("pyxis-api-token", "", "API token for Pyxis authentication")
+	checkContainerCmd.MarkFlagRequired("pyxis-api-token")
 	viper.BindPFlag("pyxis_api_token", checkContainerCmd.Flags().Lookup("pyxis-api-token"))
 
 	checkContainerCmd.Flags().String("pyxis-host", DefaultPyxisHost, "Host to use for Pyxis submissions.")
 	viper.BindPFlag("pyxis_host", checkContainerCmd.Flags().Lookup("pyxis-host"))
 
 	checkContainerCmd.Flags().String("certification-project-id", "", "Certification Project ID from conenct.redhat.com. Should be supplied without the ospid- prefix.")
+	checkContainerCmd.MarkFlagRequired("certification-project-id")
 	viper.BindPFlag("certification_project_id", checkContainerCmd.Flags().Lookup("certification-project-id"))
 
 	checkCmd.AddCommand(checkContainerCmd)
diff --git a/cmd/check_operator.go b/cmd/check_operator.go
index 5320c90..065788d 100644
--- a/cmd/check_operator.go
+++ b/cmd/check_operator.go
@@ -24,8 +24,8 @@ var checkOperatorCmd = &cobra.Command{
 	Long:  `This command will run the Certification checks for an Operator bundle image. `,
 	Args: func(cmd *cobra.Command, args []string) error {
 		if l, _ := cmd.Flags().GetBool("list-checks"); l {
-			fmt.Println(fmt.Sprintf("\n%s\n%s%s", "The checks that will be executed are the following:", "- ",
-				strings.Join(engine.OperatorPolicy(), "\n- ")))
+			fmt.Printf("\n%s\n%s%s\n", "The checks that will be executed are the following:", "- ",
+				strings.Join(engine.OperatorPolicy(), "\n- "))
 
 			// exiting gracefully instead of retuning, otherwise cobra calls RunE
 			os.Exit(0)


Test patch:
diff --git a/certification/internal/policy/container/container_suite_test.go b/certification/internal/policy/container/container_suite_test.go
index a5f32a6..1ff737f 100644
--- a/certification/internal/policy/container/container_suite_test.go
+++ b/certification/internal/policy/container/container_suite_test.go
@@ -51,6 +51,10 @@ func (fl FakeLayer) MediaType() (types.MediaType, error) {
 
 type GoodPodmanEngine struct{}
 
+func (pe GoodPodmanEngine) PullImage(imageURI string, options cli.ImagePullOptions) (*cli.PodmanOutput, error) {
+	return &cli.PodmanOutput{}, nil
+}
+
 func (pe GoodPodmanEngine) CreateContainer(imageURI string, createOptions cli.PodmanCreateOption) (*cli.PodmanCreateOutput, error) {
 	return &cli.PodmanCreateOutput{
 		ContainerId: "containerId",
@@ -69,20 +73,12 @@ func (p GoodPodmanEngine) WaitContainer(containerId string, waitOptions cli.Wait
 	return true, nil
 }
 
-func (p GoodPodmanEngine) RunSystemContainer(containerName string) (*cli.PodmanOutput, error) {
-	return &cli.PodmanOutput{}, nil
-}
-
-func (p GoodPodmanEngine) IsSystemContainerRunning(serviceName string) (bool, error) {
-	return true, nil
-}
+type BadPodmanEngine struct{}
 
-func (p GoodPodmanEngine) StopSystemContainer(serviceName string) error {
-	return nil
+func (pe BadPodmanEngine) PullImage(imageURI string, options cli.ImagePullOptions) (*cli.PodmanOutput, error) {
+	return &cli.PodmanOutput{}, nil
 }
 
-type BadPodmanEngine struct{}
-
 func (pe BadPodmanEngine) CreateContainer(imageURI string, createOptions cli.PodmanCreateOption) (*cli.PodmanCreateOutput, error) {
 	return &cli.PodmanCreateOutput{
 		ContainerId: "containerId",
@@ -100,15 +96,3 @@ func (p BadPodmanEngine) RemoveContainer(containerId string) error {
 func (p BadPodmanEngine) WaitContainer(containerId string, waitOptions cli.WaitOptions) (bool, error) {
 	return false, errors.New("the container wait had failed")
 }
-
-func (p BadPodmanEngine) RunSystemContainer(containerName string) (*cli.PodmanOutput, error) {
-	return &cli.PodmanOutput{}, nil
-}
-
-func (p BadPodmanEngine) IsSystemContainerRunning(serviceName string) (bool, error) {
-	return false, nil
-}
-
-func (p BadPodmanEngine) StopSystemContainer(serviceName string) error {
-	return nil
-}
diff --git a/certification/internal/policy/container/run_system_container_test.go b/certification/internal/policy/container/run_system_container_test.go
deleted file mode 100644
index 7710d4e..0000000
--- a/certification/internal/policy/container/run_system_container_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package container
-
-import (
-	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/cli"
-
-	. "github.com/onsi/ginkgo"
-	. "github.com/onsi/gomega"
-	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
-)
-
-var _ = Describe("RunSystemContainerCheck", func() {
-	var (
-		engine                  cli.PodmanEngine
-		runSystemContainerCheck RunSystemContainerCheck
-		imageRef                certification.ImageReference
-	)
-
-	BeforeEach(func() {
-		imageRef.ImageURI = "test-image:test-tag"
-	})
-
-	Describe("Checking that the container can run as a systemd service", func() {
-		Context("When container service starts successfully", func() {
-			It("should pass Validate", func() {
-				engine = GoodPodmanEngine{}
-				runSystemContainerCheck = *NewRunSystemContainerCheck(&engine)
-				ok, err := runSystemContainerCheck.Validate(imageRef)
-				Expect(err).ToNot(HaveOccurred())
-				Expect(ok).To(BeTrue())
-			})
-		})
-		Context("When container service does not start successfully", func() {
-			It("should not pass Validate", func() {
-				engine = BadPodmanEngine{}
-				runSystemContainerCheck = *NewRunSystemContainerCheck(&engine)
-				ok, err := runSystemContainerCheck.Validate(imageRef)
-				Expect(err).ToNot(HaveOccurred())
-				Expect(ok).To(BeFalse())
-			})
-		})
-	})
-
-})