1
0
mirror of synced 2026-02-13 13:06:56 +00:00

internal/utils: Add unit tests

Add unit tests for various utils functions.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
Sunny
2021-07-19 02:04:08 +05:30
parent 0ae39d5a0a
commit 1257b9cbc8
4 changed files with 196 additions and 6 deletions

View File

@@ -223,11 +223,7 @@ func ParseObjectKindName(input string) (kind, name string) {
// ParseObjectKindNameNamespace extracts the kind, name and namespace of a resource
// based on the '<kind>/<name>.<namespace>' format
func ParseObjectKindNameNamespace(input string) (kind, name, namespace string) {
name = input
parts := strings.Split(input, "/")
if len(parts) == 2 {
kind, name = parts[0], parts[1]
}
kind, name = ParseObjectKindName(input)
if nn := strings.Split(name, "."); len(nn) > 1 {
name = strings.Join(nn[:len(nn)-1], ".")