Skip to content

Commit

Permalink
fix: fix windows test
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <zongzhe1024@163.com>
  • Loading branch information
zong-zhe committed Mar 13, 2024
1 parent 2489510 commit d923f27
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 8 deletions.
8 changes: 7 additions & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,13 @@ func check(dep pkg.Dependency, newDepPath string) bool {
// On the windows system, it will create a junction.
func createDepRef(depName, refName string) error {
if runtime.GOOS == "windows" {
return copy.Copy(depName, refName)
// 'go-getter' continuously occupies files in '.git', causing the copy operation to fail
opt := copy.Options{
Skip: func(srcinfo os.FileInfo, src, dest string) (bool, error) {
return filepath.Base(src) == constants.GitPathSuffix, nil
},
}
return copy.Copy(depName, refName, opt)
} else {
return utils.CreateSymlink(depName, refName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "catalog"
full_name = "catalog_a29e3db"
version = "a29e3db"
sum = "kFmlrYJbJUFFTEXjC9cquc80WB+UpZ/6oMPKrfgyeks="
sum = "zhh1yHk5TrNi9apHUQF3hPOlwi5Kc75cNHjcVmGv+Qo="
url = "https://github.com/KusionStack/catalog.git"
commit = "a29e3db"
2 changes: 1 addition & 1 deletion pkg/client/test_data/resolve_metadata/kcl.mod.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "konfig"
full_name = "konfig_v0.0.1"
version = "v0.0.1"
sum = "XFvHdBAoY/+qpJWmj8cjwOwZO8a3nX/7SE35cTxQOFU="
sum = "bcUvvcR21AFUE/Zf63wx6HkqzFYH1vihmE+SCd8OOCs="
url = "https://github.com/awesome-kusion/konfig.git"
git_tag = "v0.0.1"
2 changes: 1 addition & 1 deletion pkg/client/test_data/test_init_empty_mod/kcl.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "test_name"
edition = "0.0.1"
edition = "v0.7.0"
version = "0.0.1"

1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package constants
const (
KFilePathSuffix = ".k"
TarPathSuffix = ".tar"
GitPathSuffix = ".git"
OciScheme = "oci"
FileEntry = "file"
FileWithKclModEntry = "file_with_kcl_mod"
Expand Down
2 changes: 2 additions & 0 deletions pkg/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package git
import (
"bytes"
"os"
"path/filepath"
"testing"

"gotest.tools/v3/assert"
Expand Down Expand Up @@ -48,6 +49,7 @@ func TestCloneWithOptions(t *testing.T) {
var buf bytes.Buffer

tmpdir, err := os.MkdirTemp("", "git")
tmpdir = filepath.Join(tmpdir, "git")
assert.Equal(t, err, nil)
defer func() {
rErr := os.RemoveAll(tmpdir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "catalog"
full_name = "catalog_c5435e733"
version = "c5435e733"
sum = "kFmlrYJbJUFFTEXjC9cquc80WB+UpZ/6oMPKrfgyeks="
sum = "zhh1yHk5TrNi9apHUQF3hPOlwi5Kc75cNHjcVmGv+Qo="
url = "https://github.com/KusionStack/catalog.git"
commit = "c5435e733"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "catalog"
full_name = "catalog_a29e3db"
version = "a29e3db"
sum = "kFmlrYJbJUFFTEXjC9cquc80WB+UpZ/6oMPKrfgyeks="
sum = "zhh1yHk5TrNi9apHUQF3hPOlwi5Kc75cNHjcVmGv+Qo="
url = "https://github.com/KusionStack/catalog.git"
commit = "a29e3db"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "catalog"
full_name = "catalog_a29e3db"
version = "a29e3db"
sum = "kFmlrYJbJUFFTEXjC9cquc80WB+UpZ/6oMPKrfgyeks="
sum = "zhh1yHk5TrNi9apHUQF3hPOlwi5Kc75cNHjcVmGv+Qo="
url = "https://github.com/KusionStack/catalog.git"
commit = "a29e3db"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "catalog"
full_name = "catalog_a29e3db"
version = "a29e3db"
sum = "kFmlrYJbJUFFTEXjC9cquc80WB+UpZ/6oMPKrfgyeks="
sum = "zhh1yHk5TrNi9apHUQF3hPOlwi5Kc75cNHjcVmGv+Qo="
url = "https://github.com/KusionStack/catalog.git"
commit = "a29e3db"

0 comments on commit d923f27

Please sign in to comment.