Skip to content

Commit

Permalink
update and add tests for stern
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 May 9, 2024
1 parent 57d0fe1 commit 03f5980
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 1 deletion.
1 change: 1 addition & 0 deletions .DEREK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ curators:
- welteki
- nitishkumar71
- Jasstkn
- rgee0

features:
- dco_check
Expand Down
84 changes: 84 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,90 @@ func Test_DownloadMinikube(t *testing.T) {
}
}

func Test_DownloadStern(t *testing.T) {
tools := MakeTools()
name := "stern"
version := "v1.29.0"

tool := getTool(name, tools)

tests := []test{
{
os: "darwin",
arch: "amd64",
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_darwin_amd64.tar.gz`,
},
{
os: "darwin",
arch: arch64bit,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_darwin_amd64.tar.gz`,
},
{
os: "darwin",
arch: archDarwinARM64,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_darwin_arm64.tar.gz`,
},
{
os: "linux",
arch: "amd64",
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_linux_amd64.tar.gz`,
},
{
os: "linux",
arch: arch64bit,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_linux_amd64.tar.gz`,
},
{
os: "linux",
arch: archARM7,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_linux_arm.tar.gz`,
},
{
os: "linux",
arch: archARM64,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_linux_arm64.tar.gz`,
},
{
os: "ming",
arch: arch64bit,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_windows_amd64.tar.gz`,
},
{
os: "ming",
arch: archARM7,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_windows_arm.tar.gz`,
},
{
os: "ming",
arch: archARM64,
version: version,
url: `https://github.com/stern/stern/releases/download/v1.29.0/stern_1.29.0_windows_arm64.tar.gz`,
},
}

for _, tc := range tests {
t.Run(tc.os+" "+tc.arch+" "+tc.version, func(t *testing.T) {

got, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
if err != nil {
t.Fatal(err)
}
if got != tc.url {
t.Errorf("\nwant: %s, \n got: %s", tc.url, got)
}
})
}
}

func Test_DownloadMinio(t *testing.T) {
tools := MakeTools()
name := "mc"
Expand Down
4 changes: 3 additions & 1 deletion pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,12 +1244,14 @@ https://github.com/inlets/inletsctl/releases/download/{{.Version}}/{{$fileName}}
Repo: "stern",
Name: "stern",
Description: "Multi pod and container log tailing for Kubernetes.",
BinaryTemplate: `{{$arch := "arm"}}
BinaryTemplate: `{{$arch := .Arch}}
{{- if eq .Arch "aarch64" -}}
{{$arch = "arm64"}}
{{- else if eq .Arch "x86_64" -}}
{{$arch = "amd64"}}
{{- else if eq .Arch "armv7l" -}}
{{$arch = "arm"}}
{{- end -}}
{{$os := .OS}}
Expand Down

0 comments on commit 03f5980

Please sign in to comment.