mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-22 14:57:01 +00:00
* * handle local flag * add managerfactory handling for local flag * add shortName handling for local flag * add dot git file handling for local flag * add tests * fix normal listing * add ParseGitRepository function, add viper, add testing for utils * add latest tag logic, add auto pinning and auto fetching * makke gorepomod list works with --local * make pinning works with local flag, enable auto update on fork and non-fork repo * fix: refactor to pass linter * refactor code and fix comments * edit README * refactor code to pass linting * refactor code * refactor code and enable patch branch label * ru add license * fbackward compatibility for unpin
37 lines
761 B
Go
37 lines
761 B
Go
// Copyright 2023 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package utils
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestParseGitRepositoryPath(t *testing.T) {
|
|
var testCases = map[string]struct {
|
|
urlString string
|
|
expected string
|
|
}{
|
|
"ssh format": {
|
|
urlString: "git@github.com:path/dummy.git",
|
|
expected: "github.com/path/dummy",
|
|
},
|
|
"https format": {
|
|
urlString: "https://github.com/path/dummy.git",
|
|
expected: "github.com/path/dummy",
|
|
},
|
|
"unknown format": {
|
|
urlString: "file:///path/to/repo.git/",
|
|
expected: "",
|
|
},
|
|
}
|
|
|
|
for n, tc := range testCases {
|
|
actual := ParseGitRepositoryPath(tc.urlString)
|
|
t.Log(actual)
|
|
if actual != tc.expected {
|
|
t.Errorf("%s: expected %s, got %s", n, tc.expected, actual)
|
|
}
|
|
}
|
|
}
|