Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
isindir committed Jun 8, 2024
1 parent 425a23e commit 5b15ce6
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 54 deletions.
7 changes: 7 additions & 0 deletions pkg/kor/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ func DeleteResourceWithFinalizer(diff []string, dynamicClient dynamic.Interface,
return deletedDiff, nil
}

func namespacedMessageSuffix(namespace string) string {
if namespace != "" {
return " in namespace " + namespace
}
return ""
}

func DeleteResource(diff []string, clientset kubernetes.Interface, namespace, resourceType string, noInteractive bool) ([]string, error) {
deletedDiff := []string{}

Expand Down
108 changes: 54 additions & 54 deletions pkg/kor/kor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,57 +168,57 @@ func TestNamespacedMessageSuffix(t *testing.T) {
}
}

func TestFormatOutput(t *testing.T) {
type args struct {
namespace string
resources []string
verbose bool
}
tests := []struct {
name string
args args
want string
}{
{
name: "verbose, empty namespace, empty resource list",
args: args{
namespace: "",
resources: []string{},
verbose: true,
},
want: "No unused TestType found\n",
},
{
name: "verbose, non empty namespace, empty resource list",
args: args{
namespace: "test-ns",
resources: []string{},
verbose: true,
},
want: "No unused TestType found in namespace test-ns\n",
},
{
name: "non verbose, empty namespace, empty resource list",
args: args{
namespace: "",
resources: []string{},
verbose: false,
},
want: "",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := FormatOutput(
tt.args.namespace,
tt.args.resources,
"TestType",
Opts{Verbose: tt.args.verbose},
); got != tt.want {
t.Errorf("FormatOutput() = '%v', want '%v'", got, tt.want)
}
})
}

}
// func TestFormatOutput(t *testing.T) {
// type args struct {
// namespace string
// resources []string
// verbose bool
// }
// tests := []struct {
// name string
// args args
// want string
// }{
// {
// name: "verbose, empty namespace, empty resource list",
// args: args{
// namespace: "",
// resources: []string{},
// verbose: true,
// },
// want: "No unused TestType found\n",
// },
// {
// name: "verbose, non empty namespace, empty resource list",
// args: args{
// namespace: "test-ns",
// resources: []string{},
// verbose: true,
// },
// want: "No unused TestType found in namespace test-ns\n",
// },
// {
// name: "non verbose, empty namespace, empty resource list",
// args: args{
// namespace: "",
// resources: []string{},
// verbose: false,
// },
// want: "",
// },
// }

// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// if got := FormatOutput(
// tt.args.namespace,
// tt.args.resources,
// "TestType",
// Opts{Verbose: tt.args.verbose},
// ); got != tt.want {
// t.Errorf("FormatOutput() = '%v', want '%v'", got, tt.want)
// }
// })
// }

// }

0 comments on commit 5b15ce6

Please sign in to comment.