Repository: redhat-certification/chart-verifier
Pull request #102 (2021-05-07 17:41:04)

Change has-minkubeversion to has-kubeversion
Not much more to say than the title.

Note: should not be merged until after this PR otherwise reports will start failing checks:
https://github.com/openshift-helm-charts/charts/pull/122


Patch:
diff --git a/pkg/chartverifier/certifierbuilder.go b/pkg/chartverifier/certifierbuilder.go
index 7457e67..bdf4b3b 100644
--- a/pkg/chartverifier/certifierbuilder.go
+++ b/pkg/chartverifier/certifierbuilder.go
@@ -34,7 +34,7 @@ func init() {
 	defaultRegistry.Add(checks.Check{Name: "contains-test", Type: MandatoryCheckType, Func: checks.ContainsTest})
 	defaultRegistry.Add(checks.Check{Name: "contains-values", Type: MandatoryCheckType, Func: checks.ContainsValues})
 	defaultRegistry.Add(checks.Check{Name: "contains-values-schema", Type: MandatoryCheckType, Func: checks.ContainsValuesSchema})
-	defaultRegistry.Add(checks.Check{Name: "has-minkubeversion", Type: MandatoryCheckType, Func: checks.HasMinKubeVersion})
+	defaultRegistry.Add(checks.Check{Name: "has-kubeversion", Type: MandatoryCheckType, Func: checks.HasKubeVersion})
 	defaultRegistry.Add(checks.Check{Name: "not-contains-crds", Type: MandatoryCheckType, Func: checks.NotContainCRDs})
 	defaultRegistry.Add(checks.Check{Name: "helm-lint", Type: MandatoryCheckType, Func: checks.HelmLint})
 	defaultRegistry.Add(checks.Check{Name: "not-contain-csi-objects", Type: MandatoryCheckType, Func: checks.NotContainCSIObjects})
diff --git a/pkg/chartverifier/checks/checks.go b/pkg/chartverifier/checks/checks.go
index fe55694..f1e1e90 100644
--- a/pkg/chartverifier/checks/checks.go
+++ b/pkg/chartverifier/checks/checks.go
@@ -37,8 +37,8 @@ const (
 	TestTemplatePrefix           = "templates/tests/"
 	ChartTestFilesExist          = "Chart test files exist"
 	ChartTestFilesDoesNotExist   = "Chart test files do not exist"
-	MinKuberVersionSpecified     = "Minimum Kubernetes version specified"
-	MinKuberVersionNotSpecified  = "Minimum Kubernetes version is not specified"
+	KuberVersionSpecified        = "Kubernetes version specified"
+	KuberVersionNotSpecified     = "Kubernetes version is not specified"
 	ValuesSchemaFileExist        = "Values schema file exist"
 	ValuesSchemaFileDoesNotExist = "Values schema file does not exist"
 	ValuesFileExist              = "Values file exist"
@@ -150,16 +150,16 @@ func IsCommunityChart(opts *CheckOptions) (Result, error) {
 	return notImplemented()
 }
 
-func HasMinKubeVersion(opts *CheckOptions) (Result, error) {
+func HasKubeVersion(opts *CheckOptions) (Result, error) {
 	c, _, err := LoadChartFromURI(opts.URI)
 	if err != nil {
 		return NewResult(false, err.Error()), err
 	}
 
-	r := NewResult(false, MinKuberVersionNotSpecified)
+	r := NewResult(false, KuberVersionNotSpecified)
 
 	if c.Metadata.KubeVersion != "" {
-		r.SetResult(true, MinKuberVersionSpecified)
+		r.SetResult(true, KuberVersionSpecified)
 	}
 
 	return r, nil


Test patch:
diff --git a/pkg/chartverifier/checks/checks_test.go b/pkg/chartverifier/checks/checks_test.go
index 74faf98..85db32f 100644
--- a/pkg/chartverifier/checks/checks_test.go
+++ b/pkg/chartverifier/checks/checks_test.go
@@ -223,11 +223,11 @@ func TestHasMinKubeVersion(t *testing.T) {
 	for _, tc := range positiveTestCases {
 		t.Run(tc.description, func(t *testing.T) {
 			config := viper.New()
-			r, err := HasMinKubeVersion(&CheckOptions{URI: tc.uri, Config: config})
+			r, err := HasKubeVersion(&CheckOptions{URI: tc.uri, Config: config})
 			require.NoError(t, err)
 			require.NotNil(t, r)
 			require.True(t, r.Ok)
-			require.Equal(t, MinKuberVersionSpecified, r.Reason)
+			require.Equal(t, KuberVersionSpecified, r.Reason)
 		})
 	}
 
@@ -238,11 +238,11 @@ func TestHasMinKubeVersion(t *testing.T) {
 	for _, tc := range negativeTestCases {
 		t.Run(tc.description, func(t *testing.T) {
 			config := viper.New()
-			r, err := HasMinKubeVersion(&CheckOptions{URI: tc.uri, Config: config})
+			r, err := HasKubeVersion(&CheckOptions{URI: tc.uri, Config: config})
 			require.NoError(t, err)
 			require.NotNil(t, r)
 			require.False(t, r.Ok)
-			require.Equal(t, MinKuberVersionNotSpecified, r.Reason)
+			require.Equal(t, KuberVersionNotSpecified, r.Reason)
 		})
 	}