Skip to content

Commit

Permalink
Added command execution
Browse files Browse the repository at this point in the history
  • Loading branch information
DeanDoyle1502 committed Aug 29, 2024
1 parent e226ff8 commit bde7d22
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/tests/ossm/operator/version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package operator

func TestVersion(t *testing.T) {
NewTest(t).Run(func(t TestHelper) {
t.Log("Test to verify helm chart version matches expected version")

operatorPod := pod.MatchingSelector("name=istio-operator", env.GetOperatorNamespace())

cmd := exec.Command("kubectl exec deploy/istio-operator -n " + env.GetOperatorNamespace() +
" -- cat /usr/local/share/istio-operator/helm/" + env.GetSMCPVersion() +
"/istio-control/istio-discovery/templates/deployment.yaml | grep maistra-version | awk '{print $2}'")

outputBytes, err := cmd.Output()
if err != nil{
t.Fatalf("Failed to execture command: %v", err)
}

output := string(outputBytes)

},

//kubectl exec deploy/istio-operator -- cat /usr/local/share/istio-operator/helm/v2.5/istio-control/istio-discovery/templates/deployment.yaml | grep maistra-version
4 changes: 4 additions & 0 deletions pkg/util/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ func GetOutputDir() string {
func IsMetalLBInternalIPEnabled() bool {
return getenv("METALLB_INTERNAL_IP_ENABLED", "false") == "true"
}

func GetExpectedVersion() string {
return getenv("EXPECTED_VERSION", "")
}

0 comments on commit bde7d22

Please sign in to comment.