-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #588 from kcl-lang/fix-issue-587-for-098
fix: fix failure when add git repo as dependency by protocol 'git://'
- Loading branch information
Showing
6 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package client | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"testing" | ||
|
||
"gotest.tools/v3/assert" | ||
"kcl-lang.io/kpm/pkg/downloader" | ||
"kcl-lang.io/kpm/pkg/utils" | ||
) | ||
|
||
func TestFixAddGitDep(t *testing.T) { | ||
modPath := getTestDir("test_add_git_dep") | ||
kpmcli, err := NewKpmClient() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
tmpKpmHome, err := os.MkdirTemp("", "kpm_home") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer os.RemoveAll(tmpKpmHome) | ||
|
||
kpmcli.SetHomePath(tmpKpmHome) | ||
|
||
var buf bytes.Buffer | ||
kpmcli.SetLogWriter(&buf) | ||
|
||
res, err := kpmcli.Run( | ||
WithRunSource( | ||
&downloader.Source{ | ||
Local: &downloader.Local{ | ||
Path: modPath, | ||
}, | ||
}, | ||
), | ||
) | ||
|
||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
assert.Equal(t, utils.RmNewline(res.GetRawYamlResult()), "name: flask_manifestsreplicas: 1labels: app: flask_manifests") | ||
assert.Equal(t, buf.String(), "cloning 'git://github.com/kcl-lang/flask-demo-kcl-manifests.git' with tag 'v0.1.0'\n") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "test_add_git_dep" | ||
edition = "v0.11.0" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
flask_manifests = { git = "git://github.com/kcl-lang/flask-demo-kcl-manifests.git", tag = "v0.1.0" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[dependencies] | ||
[dependencies.flask_manifests] | ||
name = "flask_manifests" | ||
full_name = "flask_manifests_0.0.1" | ||
version = "0.0.1" | ||
url = "git://github.com/kcl-lang/flask-demo-kcl-manifests.git" | ||
git_tag = "v0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import flask_manifests.app | ||
|
||
app.App{ | ||
name: "flask_manifests", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters