mirror of
https://github.com/fluxcd/flux2.git
synced 2026-05-01 23:58:51 +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:
parent
0ae39d5a0a
commit
1257b9cbc8
4 changed files with 196 additions and 6 deletions
|
|
@ -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], ".")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue