Rewrite remoteload_test integration tests (#4783)

* Better error message when git clone fails

* support file:// URLs

* rewrite remoteload_test

* lint and test fix

* fixes for kverey's comments

* document file:// remote load

* replace assert with require where appropriate

* add tests for file:// without git suffix

* fixes plus pr review from natasha

* fixes for review, lint

* revert changes to error handling

* fix skipped test
This commit is contained in:
Yunchi Luo
2022-09-19 12:13:18 -04:00
committed by GitHub
parent d6e40a3f6c
commit e62480d11c
16 changed files with 633 additions and 450 deletions

View File

@@ -52,7 +52,7 @@ func (origin *Origin) Append(path string) *Origin {
originCopy := origin.Copy()
repoSpec, err := git.NewRepoSpecFromURL(path)
if err == nil {
originCopy.Repo = repoSpec.Host + repoSpec.OrgRepo
originCopy.Repo = repoSpec.CloneSpec()
absPath := repoSpec.AbsPath()
path = absPath[strings.Index(absPath[1:], "/")+1:][1:]
originCopy.Path = ""

View File

@@ -31,14 +31,14 @@ func TestOriginAppend(t *testing.T) {
},
path: "github.com/kubernetes-sigs/kustomize/examples/multibases/dev/",
expected: `path: examples/multibases/dev
repo: https://github.com/kubernetes-sigs/kustomize
repo: https://github.com/kubernetes-sigs/kustomize.git
`,
},
}
for _, test := range tests {
actual, err := test.in.Append(test.path).String()
assert.NoError(t, err)
assert.Equal(t, actual, test.expected)
assert.Equal(t, test.expected, actual)
}
}