mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Delete some unnecessary parameter passing.
This commit is contained in:
@@ -19,12 +19,9 @@ package error
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/constants"
|
||||
)
|
||||
|
||||
func TestConfigmapError_Error(t *testing.T) {
|
||||
filepath := "/path/to/" + constants.KustomizationFileName
|
||||
errorMsg := "configmap name is missing"
|
||||
me := ConfigmapError{Path: filepath, ErrorMsg: errorMsg}
|
||||
|
||||
|
||||
@@ -20,12 +20,9 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/constants"
|
||||
)
|
||||
|
||||
func TestKustomizationError_Error(t *testing.T) {
|
||||
filepath := "/path/to/" + constants.KustomizationFileName
|
||||
errorMsg := "Kustomization not found"
|
||||
|
||||
me := KustomizationError{KustomizationPath: filepath, ErrorMsg: errorMsg}
|
||||
@@ -39,11 +36,9 @@ func TestKustomizationError_Error(t *testing.T) {
|
||||
t.Errorf("Incorrect KustomizationError.Error() message \n")
|
||||
t.Errorf("Expected errorMsg %s, but unfound\n", errorMsg)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestKustomizationErrors_Error(t *testing.T) {
|
||||
filepath := "/path/to/kustomize"
|
||||
me := KustomizationError{KustomizationPath: filepath, ErrorMsg: "Kustomization not found"}
|
||||
ce := ConfigmapError{Path: filepath, ErrorMsg: "can't find configmap name"}
|
||||
pe := PatchError{KustomizationPath: filepath, PatchFilepath: filepath, ErrorMsg: "can't find patch file"}
|
||||
|
||||
@@ -19,12 +19,9 @@ package error
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/constants"
|
||||
)
|
||||
|
||||
func TestPatchError_Error(t *testing.T) {
|
||||
filepath := "/path/to/" + constants.KustomizationFileName
|
||||
patchfilepath := "/path/to/patch/patch.yaml"
|
||||
errorMsg := "file not found"
|
||||
me := PatchError{KustomizationPath: filepath, PatchFilepath: patchfilepath, ErrorMsg: errorMsg}
|
||||
|
||||
@@ -19,12 +19,9 @@ package error
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/constants"
|
||||
)
|
||||
|
||||
func TestResourceError_Error(t *testing.T) {
|
||||
filepath := "/path/to/" + constants.KustomizationFileName
|
||||
resourcefilepath := "/path/to/resource/deployment.yaml"
|
||||
errorMsg := "file not found"
|
||||
me := ResourceError{KustomizationPath: filepath, ResourceFilepath: resourcefilepath, ErrorMsg: errorMsg}
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
)
|
||||
|
||||
func TestSecretError_Error(t *testing.T) {
|
||||
filepath := "/path/to/secret.yaml"
|
||||
errorMsg := "missing a command"
|
||||
me := SecretError{KustomizationPath: filepath, ErrorMsg: errorMsg}
|
||||
if !strings.Contains(me.Error(), filepath) {
|
||||
|
||||
@@ -19,13 +19,11 @@ package error
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/pkg/constants"
|
||||
)
|
||||
|
||||
var (
|
||||
filepath = "/path/to/" + constants.KustomizationFileName
|
||||
expected = "YAML file [/path/to/kustomization.yaml] encounters a format error.\n" +
|
||||
const (
|
||||
filepath = "/path/to/whatever"
|
||||
expected = "YAML file [/path/to/whatever] encounters a format error.\n" +
|
||||
"error converting YAML to JSON: yaml: line 2: found character that cannot start any token\n"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user