Delete some unnecessary parameter passing.

This commit is contained in:
Jeffrey Regan
2018-10-18 10:59:46 -07:00
parent 66bbae586f
commit 2b0e2725f9
24 changed files with 65 additions and 112 deletions

View File

@@ -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}

View File

@@ -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"}

View 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}

View File

@@ -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}

View File

@@ -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) {

View File

@@ -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"
)