test
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
package kubectl
|
||||
|
||||
// import (
|
||||
// "fmt"
|
||||
// )
|
||||
|
||||
// type KubectlCommandInterface interface {
|
||||
// // GetDeployment() (string, error)
|
||||
// GetDeployment() (string, error)
|
||||
// }
|
||||
|
||||
// type KubectlCommandData struct {
|
||||
// bin string
|
||||
// command string
|
||||
// }
|
||||
|
||||
// type Real KubectlCommandStatus KubectlCommandData
|
||||
|
||||
// // func (this KubectlCommandStatus) Status() (string, error) {
|
||||
// // fmt.Println("BIN ", this.bin)
|
||||
// // fmt.Println("COMMAND status")
|
||||
// // return "Res de KubectlCommandStatus", nil
|
||||
// // }
|
||||
|
||||
// func (this KubectlCommandStatus) GetDeployment() (string, error) {
|
||||
// fmt.Println("BIN ", this.bin)
|
||||
// fmt.Println("COMMAND status")
|
||||
// return "Res de GetDeployment", nil
|
||||
// }
|
@@ -1,7 +1,7 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
// "fmt"
|
||||
"fmt"
|
||||
"strings"
|
||||
"errors"
|
||||
"os/exec"
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
type KubeContext struct {
|
||||
Bin string // Chemin vers le binaire
|
||||
}
|
||||
// type KubeContext struct {
|
||||
// Bin string // Chemin vers le binaire
|
||||
// }
|
||||
|
||||
|
||||
type kubeConfig struct {
|
||||
@@ -40,9 +40,14 @@ type kubeConfigClusters struct {
|
||||
Cluster kubeConfigCluster `json:"cluster"`
|
||||
}
|
||||
|
||||
func (this KubeContext) GetCurrentContext() (string, error) {
|
||||
func (this KubectlCommand) GetCurrentContext() (string, error) {
|
||||
bin := this.Bin
|
||||
|
||||
cmd := exec.Command(this.Bin, "config", "current-context")
|
||||
msg := fmt.Sprintf("%s get config current-context", bin)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
|
||||
res := string(stdout)
|
||||
@@ -53,14 +58,23 @@ func (this KubeContext) GetCurrentContext() (string, error) {
|
||||
|
||||
// Current Context
|
||||
// namespace, server
|
||||
func (this KubeContext) GetContext() (string, string, string, error) {
|
||||
func (this KubectlCommand) GetContext() (string, string, string, error) {
|
||||
|
||||
cmd := exec.Command(this.Bin, "config", "view", "-o", "json")
|
||||
stdout, _ := cmd.CombinedOutput()
|
||||
bin := this.Bin
|
||||
|
||||
msg := fmt.Sprintf("%s config view -o json", bin)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", "", "", errors.New(string(stdout))
|
||||
}
|
||||
|
||||
var objmap kubeConfig
|
||||
|
||||
err := json.Unmarshal(stdout, &objmap)
|
||||
err = json.Unmarshal(stdout, &objmap)
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
@@ -85,7 +99,7 @@ func (this KubeContext) GetContext() (string, string, string, error) {
|
||||
return currentContext, currentNamespace, currentServer, nil
|
||||
}
|
||||
|
||||
func (this KubeContext) UseContext(newContext string) (error) {
|
||||
func (this KubectlCommand) UseContext(newContext string) (error) {
|
||||
|
||||
cmd := exec.Command(this.Bin, "config", "use-context", newContext)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
@@ -98,9 +112,14 @@ func (this KubeContext) UseContext(newContext string) (error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this KubeContext) Check() (error) {
|
||||
func (this KubectlCommand) Check() (error) {
|
||||
bin := this.Bin
|
||||
|
||||
cmd := exec.Command(this.Bin, "cluster-info")
|
||||
msg := fmt.Sprintf("%s cluster-info", bin)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Log().Debug().Msg(string(stdout))
|
||||
|
40
src/kubectl/deployment.go
Normal file
40
src/kubectl/deployment.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"errors"
|
||||
"encoding/json"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
func (this KubectlCommand) getDeployment(data KubectlObject) (map[string]any, error) {
|
||||
bin := this.Bin
|
||||
|
||||
msg := fmt.Sprintf("%s get deployment %s -o json", bin, data.Name)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
m := make(map[string]any)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return m, errors.New(string(stdout))
|
||||
}
|
||||
|
||||
var objmap getOutput
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
|
||||
kind := objmap.Kind
|
||||
status := objmap.Status
|
||||
|
||||
m["name"] = data.Name
|
||||
m["kind"] = kind
|
||||
m["replicas"] = status.Replicas
|
||||
m["UnavailableReplicas"] = status.UnavailableReplicas
|
||||
|
||||
return m, nil
|
||||
}
|
29
src/kubectl/deployment_test.go
Normal file
29
src/kubectl/deployment_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKubectDeployment(t *testing.T) {
|
||||
|
||||
fileName := filepath.Join(TEST_SRC_DIR, "deployment.json")
|
||||
cmd_json, _ := os.ReadFile(fileName)
|
||||
|
||||
cmd := getCmdKubectl(true, string(cmd_json))
|
||||
|
||||
|
||||
data := KubectlObject{Name: "dep1", Kind: "Deployment"}
|
||||
|
||||
res, err := cmd.getDeployment(data)
|
||||
|
||||
// map[string]interface {}(map[string]interface {}{"UnavailableReplicas":0, "kind":"Deployment", "name":"dep1", "replicas":1})
|
||||
assert.Nilf(t, err, "error message %s", err)
|
||||
assert.Equal(t, "Deployment", res["kind"], "TestKubectDeployment error")
|
||||
assert.Equal(t, 1, res["replicas"], "TestKubectDeployment error")
|
||||
}
|
||||
|
22
src/kubectl/kubectl.go
Normal file
22
src/kubectl/kubectl.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type KubectlCommand struct {
|
||||
Bin string
|
||||
Exec func(string,...string) commandExecutor
|
||||
}
|
||||
|
||||
////
|
||||
type commandExecutor interface {
|
||||
Output() ([]byte, error)
|
||||
CombinedOutput() ([]byte, error)
|
||||
}
|
||||
|
||||
func (this *KubectlCommand) New() {
|
||||
this.Exec = func(name string, arg ...string) commandExecutor {
|
||||
return exec.Command(name, arg...)
|
||||
}
|
||||
}
|
@@ -1,8 +1,9 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
@@ -11,14 +12,73 @@ var TEST_SRC_DIR = filepath.Join("../../test", "kubectl")
|
||||
var TEST_BIN_DIR = filepath.Join("../../test", "bin")
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
folderPath := TEST_DEST_DIR
|
||||
folderPath := TEST_DEST_DIR
|
||||
|
||||
os.RemoveAll(folderPath)
|
||||
os.MkdirAll(folderPath, os.ModePerm)
|
||||
os.RemoveAll(folderPath)
|
||||
os.MkdirAll(folderPath, os.ModePerm)
|
||||
|
||||
// call flag.Parse() here if TestMain uses flags
|
||||
exitCode := m.Run()
|
||||
// call flag.Parse() here if TestMain uses flags
|
||||
exitCode := m.Run()
|
||||
|
||||
os.RemoveAll(folderPath)
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
os.RemoveAll(folderPath)
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
|
||||
// Mock
|
||||
|
||||
type MockCommandExecutor struct {
|
||||
// Used to stub the return of the Output method
|
||||
// Could add other properties depending on testing needs
|
||||
output string
|
||||
}
|
||||
|
||||
// Implements the commandExecutor interface
|
||||
func (m *MockCommandExecutor) Output() ([]byte, error) {
|
||||
return []byte(m.output), nil
|
||||
}
|
||||
|
||||
func (m *MockCommandExecutor) CombinedOutput() ([]byte, error) {
|
||||
return []byte(m.output), nil
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
func getCmdKubectl(mock bool, output string) (KubectlCommand) {
|
||||
if mock == true {
|
||||
|
||||
mock := func(name string, args ...string) commandExecutor {
|
||||
return &MockCommandExecutor{output: output}
|
||||
}
|
||||
|
||||
cmd := KubectlCommand{Bin: "mock", Exec: mock}
|
||||
return cmd
|
||||
} else {
|
||||
bin := filepath.Join(TEST_BIN_DIR, "kubectl")
|
||||
os.Chmod(bin, 0700)
|
||||
|
||||
cmd := KubectlCommand{Bin: bin}
|
||||
cmd.New()
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
|
||||
func getCmdsKubectl(mock bool, outputs map[string]string) (KubectlCommand) {
|
||||
if mock == true {
|
||||
|
||||
mock := func(name string, args ...string) commandExecutor {
|
||||
cmd := strings.TrimSuffix(strings.Join(args," "), " ")
|
||||
output := outputs[cmd]
|
||||
return &MockCommandExecutor{output: output}
|
||||
}
|
||||
|
||||
cmd := KubectlCommand{Bin: "mock", Exec: mock}
|
||||
return cmd
|
||||
} else {
|
||||
bin := filepath.Join(TEST_BIN_DIR, "Kubectl")
|
||||
os.Chmod(bin, 0700)
|
||||
|
||||
cmd := KubectlCommand{Bin: bin}
|
||||
cmd.New()
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
|
@@ -1,122 +1,56 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"errors"
|
||||
"time"
|
||||
"os/exec"
|
||||
"encoding/json"
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
type KubeObject struct {
|
||||
Bin string // Chemin vers le binaire
|
||||
Name string
|
||||
Kind string
|
||||
}
|
||||
|
||||
type getOutput struct {
|
||||
Kind string `json:"kind"`
|
||||
Status getStatusOutput `json:"status"`
|
||||
}
|
||||
|
||||
type getStatusOutput struct {
|
||||
Replicas int `json:"replicas"`
|
||||
UnavailableReplicas int `json:"unavailableReplicas"`
|
||||
}
|
||||
|
||||
func (this KubeObject) Get() (map[string]any, error) {
|
||||
if this.Kind == "Deployment" {return this.getDeployment()}
|
||||
if this.Kind == "StatefulSet" {return this.getStatefulSet()}
|
||||
return make(map[string]any), fmt.Errorf("Kind %s inconnu", this.Kind)
|
||||
}
|
||||
|
||||
func (this KubeObject) getDeployment() (map[string]any, error) {
|
||||
bin := this.Bin
|
||||
name := this.Name
|
||||
|
||||
msg := fmt.Sprintf("%s get deployment %s -o json", bin, name)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
m := make(map[string]any)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
|
||||
cmd := exec.Command(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return m, errors.New(string(stdout))
|
||||
}
|
||||
|
||||
var objmap getOutput
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
|
||||
kind := objmap.Kind
|
||||
status := objmap.Status
|
||||
|
||||
m["name"] = name
|
||||
m["kind"] = kind
|
||||
m["replicas"] = status.Replicas
|
||||
m["UnavailableReplicas"] = status.UnavailableReplicas
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (this KubeObject) getStatefulSet() (map[string]any, error) {
|
||||
bin := this.Bin
|
||||
name := this.Name
|
||||
|
||||
msg := fmt.Sprintf("%s get statefulset %s -o json", bin, name)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
m := make(map[string]any)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
|
||||
cmd := exec.Command(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return m, errors.New(string(stdout))
|
||||
}
|
||||
|
||||
var objmap getOutput
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
|
||||
kind := objmap.Kind
|
||||
status := objmap.Status
|
||||
|
||||
m["name"] = name
|
||||
m["kind"] = kind
|
||||
m["replicas"] = status.Replicas
|
||||
m["UnavailableReplicas"] = status.UnavailableReplicas
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (this KubeObject) Wait() (error) {
|
||||
|
||||
boucle := 10
|
||||
sleep := 10000 * time.Millisecond
|
||||
|
||||
for _ = range boucle {
|
||||
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Check Deployement %s", this.Name))
|
||||
|
||||
m, err := this.Get()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ko := m["UnavailableReplicas"].(int)
|
||||
if ko == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Log().Info().Msg(fmt.Sprintf(" >> %s (Unavailable : %d)...", this.Name, ko))
|
||||
time.Sleep(sleep)
|
||||
|
||||
}
|
||||
return errors.New("Temps d'attente dépassé")
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"errors"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
|
||||
type KubectlObject struct {
|
||||
Name string
|
||||
Kind string
|
||||
}
|
||||
|
||||
type getOutput struct {
|
||||
Kind string `json:"kind"`
|
||||
Status getStatusOutput `json:"status"`
|
||||
}
|
||||
|
||||
type getStatusOutput struct {
|
||||
Replicas int `json:"replicas"`
|
||||
UnavailableReplicas int `json:"unavailableReplicas"`
|
||||
}
|
||||
|
||||
func (this KubectlCommand) Get(data KubectlObject) (map[string]any, error) {
|
||||
if data.Kind == "Deployment" {return this.getDeployment(data)}
|
||||
if data.Kind == "StatefulSet" {return this.getStatefulSet(data)}
|
||||
return make(map[string]any), fmt.Errorf("Kind %s inconnu", data.Kind)
|
||||
}
|
||||
|
||||
func (this KubectlCommand) Wait(data KubectlObject) (error) {
|
||||
|
||||
boucle := 10
|
||||
sleep := 10000 * time.Millisecond
|
||||
|
||||
for _ = range boucle {
|
||||
|
||||
log.Log().Debug().Msg(fmt.Sprintf("Check Deployement %s", data.Name))
|
||||
|
||||
m, err := this.Get(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ko := m["UnavailableReplicas"].(int)
|
||||
if ko == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Log().Info().Msg(fmt.Sprintf(" >> %s (Unavailable : %d)...", data.Name, ko))
|
||||
time.Sleep(sleep)
|
||||
|
||||
}
|
||||
return errors.New("Temps d'attente dépassé")
|
||||
}
|
28
src/kubectl/stateful_test.go
Normal file
28
src/kubectl/stateful_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKubectStatefulset(t *testing.T) {
|
||||
|
||||
fileName := filepath.Join(TEST_SRC_DIR, "statefulset.json")
|
||||
cmd_json, _ := os.ReadFile(fileName)
|
||||
|
||||
cmd := getCmdKubectl(true, string(cmd_json))
|
||||
|
||||
|
||||
data := KubectlObject{Name: "dep1", Kind: "Statefulset"}
|
||||
|
||||
res, err := cmd.getDeployment(data)
|
||||
|
||||
// map[string]interface {}(map[string]interface {}{"UnavailableReplicas":0, "kind":"StatefulSet", "name":"dep1", "replicas":1})
|
||||
assert.Nilf(t, err, "error message %s", err)
|
||||
assert.Equal(t, "StatefulSet", res["kind"], "TestKubectDeployment error")
|
||||
assert.Equal(t, 1, res["replicas"], "TestKubectDeployment error")
|
||||
}
|
43
src/kubectl/statefulset.go
Normal file
43
src/kubectl/statefulset.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"errors"
|
||||
"encoding/json"
|
||||
|
||||
log "oc-deploy/log_wrapper"
|
||||
)
|
||||
|
||||
func (this KubectlCommand) getStatefulSet(data KubectlObject) (map[string]any, error) {
|
||||
|
||||
bin := this.Bin
|
||||
name := data.Name
|
||||
|
||||
msg := fmt.Sprintf("%s get statefulset %s -o json", bin, name)
|
||||
log.Log().Debug().Msg(msg)
|
||||
|
||||
m := make(map[string]any)
|
||||
|
||||
cmd_args := strings.Split(msg, " ")
|
||||
cmd := this.Exec(cmd_args[0], cmd_args[1:]...)
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return m, errors.New(string(stdout))
|
||||
}
|
||||
|
||||
var objmap getOutput
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
|
||||
kind := objmap.Kind
|
||||
status := objmap.Status
|
||||
|
||||
m["name"] = name
|
||||
m["kind"] = kind
|
||||
m["replicas"] = status.Replicas
|
||||
m["UnavailableReplicas"] = status.UnavailableReplicas
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
@@ -1,31 +1,31 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type toolClientVersion struct {
|
||||
GitVersion string `json:"gitVersion"`
|
||||
}
|
||||
|
||||
type toolVersion struct {
|
||||
ClientVersion toolClientVersion `json:"clientVersion"`
|
||||
}
|
||||
|
||||
func Version(path string) (string, error) {
|
||||
|
||||
cmd := exec.Command(path, "version", "-o", "json", "--client=true")
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var objmap toolVersion
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
res := objmap.ClientVersion.GitVersion
|
||||
|
||||
return res, nil
|
||||
}
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type toolClientVersion struct {
|
||||
GitVersion string `json:"gitVersion"`
|
||||
}
|
||||
|
||||
type toolVersion struct {
|
||||
ClientVersion toolClientVersion `json:"clientVersion"`
|
||||
}
|
||||
|
||||
|
||||
func (this KubectlCommand) GetVersion() (string, error) {
|
||||
|
||||
cmd := this.Exec(this.Bin, "version", "-o", "json", "--client=true")
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var objmap toolVersion
|
||||
|
||||
json.Unmarshal(stdout, &objmap)
|
||||
res := objmap.ClientVersion.GitVersion
|
||||
|
||||
return res, nil
|
||||
}
|
@@ -1,22 +1,33 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKubectlVersion(t *testing.T){
|
||||
|
||||
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")
|
||||
}
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKubectlVersion(t *testing.T) {
|
||||
|
||||
cmd_json := `
|
||||
{
|
||||
"clientVersion": {
|
||||
"major": "1",
|
||||
"minor": "30",
|
||||
"gitVersion": "v1.30.3",
|
||||
"gitCommit": "6fc0a69044f1ac4c13841ec4391224a2df241460",
|
||||
"gitTreeState": "clean",
|
||||
"buildDate": "2024-07-16T23:54:40Z",
|
||||
"goVersion": "go1.22.5",
|
||||
"compiler": "gc",
|
||||
"platform": "linux/amd64"
|
||||
},
|
||||
"kustomizeVersion": "v5.0.4-0.20230601165947-6ce0bf390ce3"
|
||||
}`
|
||||
cmd := getCmdKubectl(true, cmd_json)
|
||||
|
||||
version, err := cmd.GetVersion()
|
||||
|
||||
assert.Nilf(t, err, "error message %s", err)
|
||||
assert.Equal(t, "v1.30.3", version, "TestkubectlVersion error")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user