Skip to content

Commit

Permalink
fix: k0sctl binary name change & tests
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Gee <[email protected]>
  • Loading branch information
rgee0 authored and alexellis committed Sep 21, 2024
1 parent 89582ba commit 33539a0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
56 changes: 56 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7722,3 +7722,59 @@ func Test_DownloadKeploy(t *testing.T) {
}

}

func Test_Download_k0sctl(t *testing.T) {
tools := MakeTools()
name := "k0sctl"
const toolVersion = "v0.19.0"

tool := getTool(name, tools)

tests := []test{
{
os: "mingw64_nt-10.0-18362",
arch: arch64bit,
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-win-amd64.exe",
},
{
os: "darwin",
arch: arch64bit,
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-darwin-amd64",
},
{
os: "darwin",
arch: archDarwinARM64,
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-darwin-arm64",
},
{
os: "linux",
arch: arch64bit,
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-amd64",
},
{
os: "linux",
arch: "armv7l",
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-arm",
},
{
os: "linux",
arch: archARM64,
version: toolVersion,
url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-arm64",
},
}
for _, tc := range tests {
got, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
if err != nil {
t.Fatal(err)
}
if got != tc.url {
t.Fatalf("\nwant: %s\ngot: %s", tc.url, got)
}
}
}
6 changes: 4 additions & 2 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -1965,9 +1965,11 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}}
Repo: "k0sctl",
Name: "k0sctl",
Description: "A bootstrapping and management tool for k0s clusters",
BinaryTemplate: `{{$arch := "x64"}}
{{- if eq .Arch "aarch64" -}}
BinaryTemplate: `{{$arch := "amd64"}}
{{- if or (eq .Arch "aarch64") (eq .Arch "arm64") -}}
{{$arch = "arm64"}}
{{- else if eq .Arch "armv7l" -}}
{{$arch = "arm"}}
{{- end -}}
{{$os := .OS}}
Expand Down

0 comments on commit 33539a0

Please sign in to comment.