Skip to content

Commit fb83fc5

Browse files
committed
fix: using the latest k8s tag for upgrade tests and not fixedly.
Signed-off-by: Lan Liang <[email protected]>
1 parent 796c8d2 commit fb83fc5

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

pkg/client/test_data/issues/github.com/kcl-lang/kcl/issues/1760/a/kcl.mod.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@
1919
reg = "ghcr.io"
2020
repo = "kcl-lang/fluxcd-source-controller"
2121
oci_tag = "v1.3.2"
22+
[dependencies.k8s]
23+
name = "k8s"
24+
full_name = "k8s_1.31.2"
25+
version = "1.31.2"
26+
sum = "xBZgPsnpVVyWBpahuPQHReeRx28eUHGFoaPeqbct+vs="
27+
reg = "ghcr.io"
28+
repo = "kcl-lang/k8s"
29+
oci_tag = "1.31.2"

pkg/client/test_data/resolve_metadata/with_package/kcl.mod.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[dependencies]
22
[dependencies.cc]
33
name = "cc"
4-
full_name = "flask-demo-kcl-manifests_8308200"
4+
full_name = "cc_0.0.1"
55
version = "0.0.1"
66
url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git"
77
commit = "8308200"

pkg/client/test_data/test_dep_order/kcl.mod.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
name = "helloworld"
44
full_name = "helloworld_0.1.2"
55
version = "0.1.2"
6+
sum = "PN0OMEV9M8VGFn1CtA/T3bcgZmMJmOo+RkBrLKIWYeQ="
67
reg = "ghcr.io"
78
repo = "kcl-lang/helloworld"
89
oci_tag = "0.1.2"
910
[dependencies.jsonpatch]
1011
name = "jsonpatch"
1112
full_name = "jsonpatch_0.0.5"
1213
version = "0.0.5"
14+
sum = "HFrflv3tfgcx+CkCj4Pl7EIXjr+SKH8c+hRI4/A3ThA="
1315
reg = "ghcr.io"
1416
repo = "kcl-lang/jsonpatch"
1517
oci_tag = "0.0.5"

pkg/mvs/mvs_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"golang.org/x/mod/module"
1111
"kcl-lang.io/kpm/pkg/3rdparty/mvs"
1212
"kcl-lang.io/kpm/pkg/client"
13+
"kcl-lang.io/kpm/pkg/oci"
14+
"kcl-lang.io/kpm/pkg/settings"
1315
"kcl-lang.io/kpm/pkg/test"
1416
"kcl-lang.io/kpm/pkg/utils"
1517
)
@@ -118,7 +120,12 @@ func testUpgradeToLatest(t *testing.T) {
118120

119121
upgrade, err := reqs.Upgrade(module.Version{Path: "k8s", Version: "1.27"})
120122
assert.Equal(t, err, nil)
121-
assert.Equal(t, upgrade, module.Version{Path: "k8s", Version: "1.31.2"})
123+
124+
ociClient, err := oci.NewOciClient("ghcr.io", "kcl-lang/k8s", settings.GetSettings())
125+
assert.Equal(t, err, nil)
126+
tagSelected, err := ociClient.TheLatestTag()
127+
assert.Equal(t, err, nil)
128+
assert.Equal(t, upgrade, module.Version{Path: "k8s", Version: tagSelected})
122129
}
123130

124131
func testUpgradeAllToLatest(t *testing.T) {
@@ -143,15 +150,20 @@ func testUpgradeAllToLatest(t *testing.T) {
143150
upgrade, err := mvs.UpgradeAll(target, reqs)
144151
assert.Equal(t, err, nil)
145152

153+
ociClient, err := oci.NewOciClient("ghcr.io", "kcl-lang/k8s", settings.GetSettings())
154+
assert.Equal(t, err, nil)
155+
tagSelected, err := ociClient.TheLatestTag()
156+
assert.Equal(t, err, nil)
157+
146158
expectedReqs := []module.Version{
147159
{Path: "test_with_external_deps", Version: "0.0.1"},
148160
{Path: "argo-cd-order", Version: "0.2.0"},
149161
{Path: "helloworld", Version: "0.1.4"},
150162
{Path: "json_merge_patch", Version: "0.1.1"},
151-
{Path: "k8s", Version: "1.31.2"},
163+
{Path: "k8s", Version: tagSelected},
152164
{Path: "podinfo", Version: "0.2.1"},
153165
}
154-
assert.Equal(t, upgrade, expectedReqs)
166+
assert.Equal(t, expectedReqs, upgrade)
155167
}
156168

157169
func testPrevious(t *testing.T) {

0 commit comments

Comments
 (0)