This commit is contained in:
admju
2024-09-06 07:39:46 +00:00
parent dddd5d1831
commit 052e6f1368
6 changed files with 9 additions and 20 deletions

View File

@@ -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

View File

@@ -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)
}

View File

@@ -0,0 +1 @@
package tool