From 052e6f1368deee385017bcac37821f01850af603 Mon Sep 17 00:00:00 2001 From: admju Date: Fri, 6 Sep 2024 07:39:46 +0000 Subject: [PATCH] test --- src/helm/repo_test.go | 9 --------- src/tool/conf.go | 1 + src/tool/conf_test.go | 12 +++--------- src/tool/helm_test.go | 1 + src/versionOc/online.go | 1 - test/tool/oc.yml | 5 ++++- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/helm/repo_test.go b/src/helm/repo_test.go index 37e9b7f..c9fd806 100644 --- a/src/helm/repo_test.go +++ b/src/helm/repo_test.go @@ -22,15 +22,6 @@ func TestHelmRepoAdd(t *testing.T) { res, err := repo.AddRepository() fmt.Println("TestHelmRepoAdd.24", res, err) - - // bin := filepath.Join(TEST_BIN_DIR, "helm") - // os.Chmod(bin, 0700) - // assert.FileExists(t, bin, "TestHelmVersion error") - - // version, err := Version(bin) - - // assert.Nilf(t, err, "error message %s", bin) - // assert.Equal(t, version, "v3.15.4+gfa9efb0", "TestHelmVersion error") } // helm : not found diff --git a/src/tool/conf.go b/src/tool/conf.go index d14f325..4801c21 100644 --- a/src/tool/conf.go +++ b/src/tool/conf.go @@ -9,6 +9,7 @@ type toolsData struct { Tools []ToolData `yaml:"tools"` } +// Lecture de la liste des outils func FromConfigFile(filename string) ([]ToolData, error) { yamlFile, _ := os.ReadFile(filename) var data toolsData diff --git a/src/tool/conf_test.go b/src/tool/conf_test.go index b0fd936..1d723f7 100644 --- a/src/tool/conf_test.go +++ b/src/tool/conf_test.go @@ -2,6 +2,7 @@ package tool import ( "fmt" + // "os" "path/filepath" "testing" @@ -15,13 +16,6 @@ func TestToolConf(t *testing.T) { data, err := FromConfigFile(src) fmt.Println("data", src, data, err) - - bin := filepath.Join(TEST_BIN_DIR, "kubectl") - os.Chmod(bin, 0700) - assert.FileExists(t, bin, "TestKubectlVersion error") - - version, err := Version(bin) - - assert.Nilf(t, err, "error message %s", bin) - assert.Equal(t, "v1.30.3", version, "TestKubectlVersion error") + assert.Equal(t, "kubectl", data[0].Name, "TestToolConf error") + assert.Nilf(t, err, "error message %s", src) } \ No newline at end of file diff --git a/src/tool/helm_test.go b/src/tool/helm_test.go index e69de29..05b1676 100644 --- a/src/tool/helm_test.go +++ b/src/tool/helm_test.go @@ -0,0 +1 @@ +package tool diff --git a/src/versionOc/online.go b/src/versionOc/online.go index 46cbbd4..e23acf1 100644 --- a/src/versionOc/online.go +++ b/src/versionOc/online.go @@ -15,7 +15,6 @@ import ( func GetFromOnline(version string) (string, string, error) { - fmt.Println(" ONLINE 18") version2 := version if version == "latest" { versionLatest, err := readLatestFromOnline() diff --git a/test/tool/oc.yml b/test/tool/oc.yml index 9cb17e0..01874b6 100644 --- a/test/tool/oc.yml +++ b/test/tool/oc.yml @@ -1,4 +1,7 @@ --- tools: - + - name: kubectl + url: https://dl.k8s.io/release/%s/bin/linux/amd64/kubectl + version: v1.30.3 +