Repository: redhat-openshift-ecosystem/openshift-preflight
Pull request #728 (2022-07-01 16:22:21)

Add tests confirming check metadata is never empty
These functions are red in test coverage, and generally that's because they don't really have any logic to them... but we should at least confirm that they're not empty, so these tests confirm that the values returned are never empty.

Signed-off-by: Jose R. Gonzalez <jose@flutes.dev>

openshift-ci[bot]: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/728#" title="Author self-approved">komish</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=redhat-openshift-ecosystem%2Fopenshift-preflight).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/redhat-openshift-ecosystem/openshift-preflight/blob/main/OWNERS)~~ [komish]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
coveralls: 
[![Coverage Status](https://coveralls.io/builds/50532333/badge)](https://coveralls.io/builds/50532333)

Coverage increased (+5.3%) to 83.445% when pulling **687190158f421de9493919788db0e6fc7a547075 on komish:add-check-metadata-tests** into **5a93a15aba8980fcf6184bb3134de4b6f0ca4b13 on redhat-openshift-ecosystem:main**.

dcibot: -  SUCCESS https://www.distributed-ci.io/jobs/79727264-aa19-4f5a-82c0-71dd0b7746d9/jobStates
 from https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/728

Patch:
diff --git a/certification/internal/policy/container/has_modified_files.go b/certification/internal/policy/container/has_modified_files.go
index a42870a..49acdf4 100644
--- a/certification/internal/policy/container/has_modified_files.go
+++ b/certification/internal/policy/container/has_modified_files.go
@@ -7,6 +7,7 @@ import (
 	"io"
 	"strings"
 
+	rpmdb "github.com/knqyf263/go-rpmdb/pkg"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
 	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification/internal/rpm"
 	log "github.com/sirupsen/logrus"
@@ -45,19 +46,9 @@ func (p *HasModifiedFilesCheck) getDataToValidate(ctx context.Context, imgRef ce
 		return nil, fmt.Errorf("could not get rpm list: %w", err)
 	}
 
-	// Get the files put in place on the filesystem by the
-	// installed packages.
-	packageFiles := make(map[string]struct{}, len(pkgList))
-	for _, pkg := range pkgList {
-		filenames, err := pkg.InstalledFileNames()
-		if err != nil {
-			return nil, fmt.Errorf("could not list installed files: %w", err)
-		}
-		for _, file := range filenames {
-			// A struct is used here, but it is unimportant and
-			// should not have value.
-			packageFiles[file] = struct{}{}
-		}
+	packageFiles, err := p.getInstalledFilesFor(pkgList)
+	if err != nil {
+		return nil, fmt.Errorf("could not list installed files: %w", err)
 	}
 
 	layers, err := imgRef.ImageInfo.Layers()
@@ -93,11 +84,9 @@ func (p *HasModifiedFilesCheck) getDataToValidate(ctx context.Context, imgRef ce
 		}
 	}
 
-	// In cases where the image was built FROM scratch,
-	// we drop the empty layer. This should be relatively rare,
-	// but it is the case in images such as ubi-micro. This works
-	// around using that empty layer as a base layer in Validate().
-	if len(files[0]) == 0 {
+	files, dropped := p.dropFirstLayerIfEmpty(files)
+	if dropped {
+		// tell the user the first layer was dropped
 		diff0, _ := layers[0].DiffID()
 		diff1, _ := layers[1].DiffID()
 		log.Debugf(
@@ -105,12 +94,25 @@ func (p *HasModifiedFilesCheck) getDataToValidate(ctx context.Context, imgRef ce
 			diff0.String(),
 			diff1.String(),
 		)
-		files = files[1:] // shift the empty layer out.
 	}
 
 	return &packageFilesRef{files, packageFiles}, nil
 }
 
+// dropFirstLayerIfEmpty will evaluate the length of the first layer and will drop its entry in files if it's empty.
+// This avoids establishing a baseline of files installed in the original layer with an empty list. An example
+// of when this should occur is in cases where the image was built FROM scratch, such as ubi-micro. This is required
+// to ensure we don't attempt to validate against an empty layer.
+func (p *HasModifiedFilesCheck) dropFirstLayerIfEmpty(files [][]string) ([][]string, bool) {
+	var dropped bool
+	if len(files[0]) == 0 {
+		files = files[1:] // shift the empty layer out.
+		dropped = true
+	}
+
+	return files, dropped
+}
+
 // validate compares the list of LayerFiles and PackageFiles to see what PackageFiles
 // have been modified within the additional layers.
 func (p *HasModifiedFilesCheck) validate(packageFilesRef *packageFilesRef) (bool, error) {
@@ -210,3 +212,22 @@ func untar(pathChan chan<- string, r io.Reader) error {
 		}
 	}
 }
+
+// getInstalledFilesFor returns a map of installed files by pkgs. The returned map only contains
+// relevant keys to aid in lookup; values are unimportant.
+func (p *HasModifiedFilesCheck) getInstalledFilesFor(pkgList []*rpmdb.PackageInfo) (map[string]struct{}, error) {
+	installedFiles := make(map[string]struct{}, len(pkgList))
+	for _, pkg := range pkgList {
+		filenames, err := pkg.InstalledFileNames()
+		if err != nil {
+			return nil, err
+		}
+		for _, file := range filenames {
+			// A struct is used here, but it is unimportant and
+			// should not have value.
+			installedFiles[file] = struct{}{}
+		}
+	}
+
+	return installedFiles, nil
+}
diff --git a/certification/types.go b/certification/types.go
index f84eaff..c822de8 100644
--- a/certification/types.go
+++ b/certification/types.go
@@ -2,7 +2,7 @@ package certification
 
 import v1 "github.com/google/go-containerregistry/pkg/v1"
 
-// ImasgeReference holds all things image-related
+// ImageReference holds all things image-related
 type ImageReference struct {
 	ImageURI        string
 	ImageFSPath     string


Test patch:
diff --git a/certification/internal/policy/container/base_on_ubi_test.go b/certification/internal/policy/container/base_on_ubi_test.go
index af994d4..79b305e 100644
--- a/certification/internal/policy/container/base_on_ubi_test.go
+++ b/certification/internal/policy/container/base_on_ubi_test.go
@@ -92,5 +92,25 @@ var _ = Describe("BaseOnUBI", func() {
 				Expect(ok).To(BeFalse())
 			})
 		})
+
+		Context("When checking metadata", func() {
+			Context("The check name should not be empty", func() {
+				Expect(basedOnUbiCheck.Name()).ToNot(BeEmpty())
+			})
+
+			Context("The metadata keys should not be empty", func() {
+				meta := basedOnUbiCheck.Metadata()
+				Expect(meta.CheckURL).ToNot(BeEmpty())
+				Expect(meta.Description).ToNot(BeEmpty())
+				Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+				// Level is optional.
+			})
+
+			Context("The help text should not be empty", func() {
+				help := basedOnUbiCheck.Help()
+				Expect(help.Message).ToNot(BeEmpty())
+				Expect(help.Suggestion).ToNot(BeEmpty())
+			})
+		})
 	})
 })
diff --git a/certification/internal/policy/container/has_license_test.go b/certification/internal/policy/container/has_license_test.go
index 386d0f0..ecb8b2e 100644
--- a/certification/internal/policy/container/has_license_test.go
+++ b/certification/internal/policy/container/has_license_test.go
@@ -75,5 +75,25 @@ var _ = Describe("HasLicense", func() {
 			err := os.RemoveAll(imgRef.ImageFSPath)
 			Expect(err).ToNot(HaveOccurred())
 		})
+
+		Context("When checking metadata", func() {
+			Context("The check name should not be empty", func() {
+				Expect(HasLicense.Name()).ToNot(BeEmpty())
+			})
+
+			Context("The metadata keys should not be empty", func() {
+				meta := HasLicense.Metadata()
+				Expect(meta.CheckURL).ToNot(BeEmpty())
+				Expect(meta.Description).ToNot(BeEmpty())
+				Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+				// Level is optional.
+			})
+
+			Context("The help text should not be empty", func() {
+				help := HasLicense.Help()
+				Expect(help.Message).ToNot(BeEmpty())
+				Expect(help.Suggestion).ToNot(BeEmpty())
+			})
+		})
 	})
 })
diff --git a/certification/internal/policy/container/has_modifed_files_test.go b/certification/internal/policy/container/has_modifed_files_test.go
index a20b4a2..d049fbc 100644
--- a/certification/internal/policy/container/has_modifed_files_test.go
+++ b/certification/internal/policy/container/has_modifed_files_test.go
@@ -1,8 +1,13 @@
 package container
 
 import (
+	"context"
+	"path"
+
+	rpmdb "github.com/knqyf263/go-rpmdb/pkg"
 	. "github.com/onsi/ginkgo/v2"
 	. "github.com/onsi/gomega"
+	"github.com/redhat-openshift-ecosystem/openshift-preflight/certification"
 )
 
 var _ = Describe("HasModifiedFiles", func() {
@@ -35,6 +40,27 @@ var _ = Describe("HasModifiedFiles", func() {
 			},
 		}
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(HasModifiedFiles.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := HasModifiedFiles.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := HasModifiedFiles.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking if it has any modified RPM files", func() {
 		Context("When there are no modified RPM files found", func() {
 			It("should pass validate", func() {
@@ -56,4 +82,74 @@ var _ = Describe("HasModifiedFiles", func() {
 			})
 		})
 	})
+
+	Context("When building the installed file list for installed packages", func() {
+		const (
+			basename = "foobasename"
+			dirname  = "foodirname"
+			dirindex = 0
+		)
+		var goodPkgList []*rpmdb.PackageInfo
+		var badPkgList []*rpmdb.PackageInfo
+
+		BeforeEach(func() {
+			goodPkgList = []*rpmdb.PackageInfo{
+				{
+					BaseNames:  []string{basename},
+					DirIndexes: []int32{dirindex},
+					DirNames:   []string{dirname},
+				},
+			}
+
+			badPkgList = []*rpmdb.PackageInfo{
+				{
+					BaseNames:  []string{basename},
+					DirIndexes: []int32{dirindex},
+					DirNames:   []string{dirname, "extra"},
+				},
+			}
+		})
+		It("should contain all files installed by the package according to its metadata", func() {
+			files, err := HasModifiedFiles.getInstalledFilesFor(goodPkgList)
+			Expect(err).ToNot(HaveOccurred())
+
+			_, ok := files[path.Join(dirname, basename)]
+			Expect(ok).To(BeTrue())
+		})
+
+		It("should fail if the rpm is invalid", func() {
+			_, err := HasModifiedFiles.getInstalledFilesFor(badPkgList)
+			Expect(err).To(HaveOccurred())
+		})
+	})
+
+	Context("When evaluating files in each layer", func() {
+		var files [][]string
+		BeforeEach(func() {
+			files = [][]string{
+				{"foo"},
+				{"bar"},
+			}
+		})
+		It("should shift over to the next layer if the first layer is empty", func() {
+			files[0] = []string{}
+			shiftedFiles, shifted := HasModifiedFiles.dropFirstLayerIfEmpty(files)
+			Expect(shiftedFiles).To(BeEquivalentTo(files[1:]))
+			Expect(shifted).To(BeTrue())
+		})
+
+		It("should start at the first layer if it's not empty", func() {
+			unshiftedFiles, shifted := HasModifiedFiles.dropFirstLayerIfEmpty(files)
+			Expect(unshiftedFiles).To(BeEquivalentTo(files))
+			Expect(shifted).To(BeFalse())
+		})
+	})
+
+	Context("When calling the top level Validate", func() {
+		It("should fail with an invalid ImageReference", func() {
+			passed, err := HasModifiedFiles.Validate(context.TODO(), certification.ImageReference{})
+			Expect(err).To(HaveOccurred())
+			Expect(passed).To(BeFalse())
+		})
+	})
 })
diff --git a/certification/internal/policy/container/has_prohibited_packages_test.go b/certification/internal/policy/container/has_prohibited_packages_test.go
index cf9af1d..15751c4 100644
--- a/certification/internal/policy/container/has_prohibited_packages_test.go
+++ b/certification/internal/policy/container/has_prohibited_packages_test.go
@@ -21,6 +21,27 @@ var _ = Describe("HasNoProhibitedPackages", func() {
 			"prohibitted",
 		}
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(HasNoProhibitedPackages.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := HasNoProhibitedPackages.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := HasNoProhibitedPackages.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking if it has an prohibited packages", func() {
 		Context("When there are no prohibited packages found", func() {
 			It("should pass validate", func() {
diff --git a/certification/internal/policy/container/has_required_labels_test.go b/certification/internal/policy/container/has_required_labels_test.go
index 40380c2..2f6089b 100644
--- a/certification/internal/policy/container/has_required_labels_test.go
+++ b/certification/internal/policy/container/has_required_labels_test.go
@@ -56,6 +56,26 @@ var _ = Describe("HasRequiredLabels", func() {
 		imageRef.ImageInfo = &fakeImage
 	})
 
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(hasRequiredLabelsCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := hasRequiredLabelsCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := hasRequiredLabelsCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking for required labels", func() {
 		Context("When it has required labels", func() {
 			It("should pass Validate", func() {
diff --git a/certification/internal/policy/container/has_unique_tag_test.go b/certification/internal/policy/container/has_unique_tag_test.go
index ada1a4b..65cedbb 100644
--- a/certification/internal/policy/container/has_unique_tag_test.go
+++ b/certification/internal/policy/container/has_unique_tag_test.go
@@ -45,6 +45,27 @@ var _ = Describe("UniqueTag", func() {
 		err = crane.Tag(dst, "unique-tag")
 		Expect(err).ToNot(HaveOccurred())
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(hasUniqueTagCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := hasUniqueTagCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := hasUniqueTagCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking for unique tags", func() {
 		Context("When it has tags other than latest", func() {
 			It("should pass Validate", func() {
diff --git a/certification/internal/policy/container/max_layers_test.go b/certification/internal/policy/container/max_layers_test.go
index ac22b3d..8559b3a 100644
--- a/certification/internal/policy/container/max_layers_test.go
+++ b/certification/internal/policy/container/max_layers_test.go
@@ -39,6 +39,26 @@ var _ = Describe("LessThanMaxLayers", func() {
 		imgRef.ImageInfo = &fakeImage
 	})
 
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(maxLayersCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := maxLayersCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := maxLayersCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking for less than max layers", func() {
 		Context("When it has fewer layers than max", func() {
 			It("should pass Validate", func() {
diff --git a/certification/internal/policy/container/runs_as_nonroot_test.go b/certification/internal/policy/container/runs_as_nonroot_test.go
index 2eb3c8b..024d673 100644
--- a/certification/internal/policy/container/runs_as_nonroot_test.go
+++ b/certification/internal/policy/container/runs_as_nonroot_test.go
@@ -47,6 +47,26 @@ var _ = Describe("RunAsNonRoot", func() {
 		imageRef.ImageInfo = &fakeImage
 	})
 
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(runAsNonRoot.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := runAsNonRoot.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := runAsNonRoot.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Checking manifest user is not root", func() {
 		Context("When manifest user is not root", func() {
 			It("should pass Validate", func() {
diff --git a/certification/internal/policy/operator/deployable_by_olm_test.go b/certification/internal/policy/operator/deployable_by_olm_test.go
index afc68a7..41d3a37 100644
--- a/certification/internal/policy/operator/deployable_by_olm_test.go
+++ b/certification/internal/policy/operator/deployable_by_olm_test.go
@@ -119,6 +119,27 @@ var _ = Describe("DeployableByOLMCheck", func() {
 	AfterEach(func() {
 		artifacts.Reset()
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(deployableByOLMCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := deployableByOLMCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := deployableByOLMCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("When deploying an operator using OLM", func() {
 		Context("When CSV has been created successfully", func() {
 			It("Should pass Validate", func() {
diff --git a/certification/internal/policy/operator/scorecard_basic_check_spec_test.go b/certification/internal/policy/operator/scorecard_basic_check_spec_test.go
index df1edb3..d878278 100644
--- a/certification/internal/policy/operator/scorecard_basic_check_spec_test.go
+++ b/certification/internal/policy/operator/scorecard_basic_check_spec_test.go
@@ -71,6 +71,27 @@ var _ = Describe("ScorecardBasicCheck", func() {
 		}
 		scorecardBasicCheck = *NewScorecardBasicSpecCheck(fakeEngine, "myns", "mysa", "", "20")
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(scorecardBasicCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := scorecardBasicCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := scorecardBasicCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Operator Bundle Scorecard", func() {
 		Context("When Operator Bundle Scorecard Basic Check has a pass", func() {
 			It("Should pass Validate", func() {
diff --git a/certification/internal/policy/operator/scorecard_olm_suite_test.go b/certification/internal/policy/operator/scorecard_olm_suite_test.go
index dd29896..e262a67 100644
--- a/certification/internal/policy/operator/scorecard_olm_suite_test.go
+++ b/certification/internal/policy/operator/scorecard_olm_suite_test.go
@@ -71,6 +71,27 @@ var _ = Describe("ScorecardBasicCheck", func() {
 		}
 		scorecardOlmSuiteCheck = *NewScorecardOlmSuiteCheck(fakeEngine, "myns", "mysa", "", "20")
 	})
+
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(scorecardOlmSuiteCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := scorecardOlmSuiteCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := scorecardOlmSuiteCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Operator Bundle Scorecard", func() {
 		Context("When Operator Bundle Scorecard OLM Suite Check has a pass", func() {
 			It("Should pass Validate", func() {
diff --git a/certification/internal/policy/operator/validate_operator_bundle_test.go b/certification/internal/policy/operator/validate_operator_bundle_test.go
index 948d77a..7924e67 100644
--- a/certification/internal/policy/operator/validate_operator_bundle_test.go
+++ b/certification/internal/policy/operator/validate_operator_bundle_test.go
@@ -58,6 +58,26 @@ var _ = Describe("BundleValidateCheck", func() {
 
 		bundleValidateCheck = *NewValidateOperatorBundleCheck(fakeEngine)
 	})
+	Context("When checking metadata", func() {
+		Context("The check name should not be empty", func() {
+			Expect(bundleValidateCheck.Name()).ToNot(BeEmpty())
+		})
+
+		Context("The metadata keys should not be empty", func() {
+			meta := bundleValidateCheck.Metadata()
+			Expect(meta.CheckURL).ToNot(BeEmpty())
+			Expect(meta.Description).ToNot(BeEmpty())
+			Expect(meta.KnowledgeBaseURL).ToNot(BeEmpty())
+			// Level is optional.
+		})
+
+		Context("The help text should not be empty", func() {
+			help := bundleValidateCheck.Help()
+			Expect(help.Message).ToNot(BeEmpty())
+			Expect(help.Suggestion).ToNot(BeEmpty())
+		})
+	})
+
 	Describe("Operator Bundle Validate", func() {
 		Context("When Operator Bundle Validate passes", func() {
 			It("Should pass Validate", func() {