From 6071084c25703ee04857e2af28f70e1fa062fe8b Mon Sep 17 00:00:00 2001 From: Akash Kumar Date: Mon, 19 Feb 2024 19:33:10 +0530 Subject: [PATCH] address review comments Signed-off-by: Akash Kumar --- pkg/client/client.go | 4 ++-- pkg/client/client_test.go | 2 +- .../kpm/exec_inside_pkg/add_with_name_1/test_suite.stdout | 4 +--- .../kpm/exec_inside_pkg/add_with_name_2/test_suite.stdout | 3 +-- .../kpm/exec_inside_pkg/add_with_name_3/test_suite.stdout | 1 - .../kpm/exec_inside_pkg/add_with_path_2/test_suite.stdout | 3 +-- .../kpm/exec_inside_pkg/add_with_path_3/test_suite.stdout | 3 +-- .../kpm/exec_inside_pkg/add_with_path_4/test_suite.stdout | 1 - .../kpm/exec_inside_pkg/add_with_path_5/test_suite.stdout | 3 +-- 9 files changed, 8 insertions(+), 16 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index d7f57e57..fddf5166 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1211,8 +1211,8 @@ func (c *KpmClient) downloadDeps(deps pkg.Dependencies, lockDeps pkg.Dependencie } return nil, err } - source := fmt.Sprintf("%s@%s", d.Name, d.Version) + source = strings.TrimRight(source, "@") err = depGraph.AddVertex(source) if err != nil && err != graph.ErrVertexAlreadyExists { return nil, err @@ -1224,7 +1224,7 @@ func (c *KpmClient) downloadDeps(deps pkg.Dependencies, lockDeps pkg.Dependencie return nil, reporter.NewErrorEvent( reporter.CircularDependencyExist, nil, - "adding dependencies results in a cycle", + fmt.Sprintf("adding %s as a dependency results in a cycle", source), ) } return nil, err diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 2775390d..273ed5a8 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -179,7 +179,7 @@ func TestCyclicDependency(t *testing.T) { _, _, err = kpmcli.InitGraphAndDownloadDeps(kclPkg) assert.Equal(t, err, reporter.NewErrorEvent( - reporter.CircularDependencyExist, nil, "adding dependencies results in a cycle", + reporter.CircularDependencyExist, nil, "adding bbb as a dependency results in a cycle", )) err = os.Chdir(currentDir) diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_1/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_1/test_suite.stdout index c9d63c8d..664b1334 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_1/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_1/test_suite.stdout @@ -1,5 +1,3 @@ adding dependency 'kcl1' the lastest version '0.0.1' will be added -downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' -adding dependencies results in a cycle +downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_2/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_2/test_suite.stdout index f3e64906..ee2e9c3e 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_2/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_2/test_suite.stdout @@ -2,5 +2,4 @@ the lastest version '0.0.1' will be added downloading 'test/kcl2:0.0.1' from 'localhost:5001/test/kcl2:0.0.1' downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' -downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle +downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_3/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_3/test_suite.stdout index f3e64906..38f8193c 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_3/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_name_3/test_suite.stdout @@ -3,4 +3,3 @@ the lastest version '0.0.1' will be added downloading 'test/kcl2:0.0.1' from 'localhost:5001/test/kcl2:0.0.1' downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_2/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_2/test_suite.stdout index 37ffe0b0..079b3648 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_2/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_2/test_suite.stdout @@ -1,4 +1,3 @@ adding dependency 'a_kcl_pkg_dep_pkg_name' downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' -downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle +downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_3/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_3/test_suite.stdout index 34999107..f4f1cdda 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_3/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_3/test_suite.stdout @@ -1,5 +1,4 @@ adding dependency 'a_kcl_pkg_dep_pkg_name' downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' downloading 'test/kcl2:0.0.1' from 'localhost:5001/test/kcl2:0.0.1' -downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle +downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' \ No newline at end of file diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_4/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_4/test_suite.stdout index 34999107..dd9bfb4a 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_4/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_4/test_suite.stdout @@ -2,4 +2,3 @@ downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' downloading 'test/kcl2:0.0.1' from 'localhost:5001/test/kcl2:0.0.1' downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle diff --git a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_5/test_suite.stdout b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_5/test_suite.stdout index 34999107..f4f1cdda 100644 --- a/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_5/test_suite.stdout +++ b/test/e2e/test_suites/kpm/exec_inside_pkg/add_with_path_5/test_suite.stdout @@ -1,5 +1,4 @@ adding dependency 'a_kcl_pkg_dep_pkg_name' downloading 'test/k8s:1.27' from 'localhost:5001/test/k8s:1.27' downloading 'test/kcl2:0.0.1' from 'localhost:5001/test/kcl2:0.0.1' -downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' -adding dependencies results in a cycle +downloading 'test/kcl1:0.0.1' from 'localhost:5001/test/kcl1:0.0.1' \ No newline at end of file