Skip to content

Commit a840535

Browse files
committed
test: Download correct cilium-istioctl for the executing OS.
Only use the Ginkgo runtime OS for determining which cilium-istioctl binary to download is the command executor is local, otherwise default to "linux". This supports Ginkgo running in OSX both with local and SSH Executors. Fixes: #11905 Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
1 parent 331aab4 commit a840535

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

test/helpers/local_node.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var (
3737

3838
// Executor executes commands
3939
type Executor interface {
40+
IsLocal() bool
4041
CloseSSHClient()
4142
Exec(cmd string, options ...ExecOptions) *CmdRes
4243
ExecContext(ctx context.Context, cmd string, options ...ExecOptions) *CmdRes
@@ -66,6 +67,11 @@ func CreateLocalExecutor(env []string) *LocalExecutor {
6667
return &LocalExecutor{env: env}
6768
}
6869

70+
// IsLocal returns true if commands are executed on the Ginkgo host
71+
func (s *LocalExecutor) IsLocal() bool {
72+
return true
73+
}
74+
6975
// Logger returns logger for executor
7076
func (s *LocalExecutor) Logger() *logrus.Entry {
7177
return s.logger

test/helpers/node.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ func CreateSSHMeta(host string, port int, user string) *SSHMeta {
5454
}
5555
}
5656

57+
// IsLocal returns true if commands are executed on the Ginkgo host
58+
func (s *SSHMeta) IsLocal() bool {
59+
return false
60+
}
61+
5762
// Logger returns logger for SSHMeta
5863
func (s *SSHMeta) Logger() *logrus.Entry {
5964
return s.logger

test/k8sT/istio.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ var _ = Describe("K8sIstioTest", func() {
5858
"linux": "linux",
5959
}
6060

61-
ciliumIstioctlURL = "https://github.com/cilium/istio/releases/download/" + istioVersion + prerelease + "/cilium-istioctl-" + istioVersion + "-" + ciliumIstioctlOSes[runtime.GOOS] + ".tar.gz"
6261
// istioServiceNames is the set of Istio services needed for the tests
6362
istioServiceNames = []string{
6463
"istio-ingressgateway",
@@ -87,6 +86,12 @@ var _ = Describe("K8sIstioTest", func() {
8786
kubectl = helpers.CreateKubectl(helpers.K8s1VMName(), logger)
8887

8988
By("Downloading cilium-istioctl")
89+
os := "linux"
90+
if kubectl.IsLocal() {
91+
// Use Ginkgo runtime OS instead when commands are executed in the local Ginkgo host
92+
os = ciliumIstioctlOSes[runtime.GOOS]
93+
}
94+
ciliumIstioctlURL := "https://github.com/cilium/istio/releases/download/" + istioVersion + prerelease + "/cilium-istioctl-" + istioVersion + "-" + os + ".tar.gz"
9095
res := kubectl.Exec(fmt.Sprintf("curl --retry 5 -L %s | tar xz", ciliumIstioctlURL))
9196
res.ExpectSuccess("unable to download %s", ciliumIstioctlURL)
9297
res = kubectl.ExecShort("./cilium-istioctl version")

0 commit comments

Comments
 (0)