@@ -9292,3 +9292,109 @@ func Test_LogCLI(t *testing.T) {
92929292 })
92939293 }
92949294}
9295+
9296+ func Test_DownloadAge (t * testing.T ) {
9297+ tools := MakeTools ()
9298+ name := "age"
9299+ const version = "v1.3.1"
9300+
9301+ tool := getTool (name , tools )
9302+
9303+ tests := []test {
9304+ {
9305+ os : "linux" ,
9306+ arch : arch64bit ,
9307+ version : version ,
9308+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-amd64.tar.gz` ,
9309+ },
9310+ {
9311+ os : "linux" ,
9312+ arch : archARM64 ,
9313+ version : version ,
9314+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-arm64.tar.gz` ,
9315+ },
9316+ {
9317+ os : "darwin" ,
9318+ arch : arch64bit ,
9319+ version : version ,
9320+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-amd64.tar.gz` ,
9321+ },
9322+ {
9323+ os : "darwin" ,
9324+ arch : archDarwinARM64 ,
9325+ version : version ,
9326+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-arm64.tar.gz` ,
9327+ },
9328+ {
9329+ os : "ming" ,
9330+ arch : arch64bit ,
9331+ version : version ,
9332+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-windows-amd64.zip` ,
9333+ },
9334+ }
9335+
9336+ for _ , tc := range tests {
9337+ t .Run (fmt .Sprintf ("Download for: %s %s %s" , tc .os , tc .arch , tc .version ), func (r * testing.T ) {
9338+ got , _ , err := tool .GetURL (tc .os , tc .arch , tc .version , false )
9339+ if err != nil {
9340+ t .Fatal (err )
9341+ }
9342+ if got != tc .url {
9343+ t .Errorf ("\n want: %s\n got: %s" , tc .url , got )
9344+ }
9345+ })
9346+ }
9347+ }
9348+
9349+ func Test_DownloadAgeKeygen (t * testing.T ) {
9350+ tools := MakeTools ()
9351+ name := "age-keygen"
9352+ const version = "v1.3.1"
9353+
9354+ tool := getTool (name , tools )
9355+
9356+ tests := []test {
9357+ {
9358+ os : "linux" ,
9359+ arch : arch64bit ,
9360+ version : version ,
9361+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-amd64.tar.gz` ,
9362+ },
9363+ {
9364+ os : "linux" ,
9365+ arch : archARM64 ,
9366+ version : version ,
9367+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-linux-arm64.tar.gz` ,
9368+ },
9369+ {
9370+ os : "darwin" ,
9371+ arch : arch64bit ,
9372+ version : version ,
9373+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-amd64.tar.gz` ,
9374+ },
9375+ {
9376+ os : "darwin" ,
9377+ arch : archDarwinARM64 ,
9378+ version : version ,
9379+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-darwin-arm64.tar.gz` ,
9380+ },
9381+ {
9382+ os : "ming" ,
9383+ arch : arch64bit ,
9384+ version : version ,
9385+ url : `https://github.com/FiloSottile/age/releases/download/v1.3.1/age-v1.3.1-windows-amd64.zip` ,
9386+ },
9387+ }
9388+
9389+ for _ , tc := range tests {
9390+ t .Run (fmt .Sprintf ("Download for: %s %s %s" , tc .os , tc .arch , tc .version ), func (r * testing.T ) {
9391+ got , _ , err := tool .GetURL (tc .os , tc .arch , tc .version , false )
9392+ if err != nil {
9393+ t .Fatal (err )
9394+ }
9395+ if got != tc .url {
9396+ t .Errorf ("\n want: %s\n got: %s" , tc .url , got )
9397+ }
9398+ })
9399+ }
9400+ }
0 commit comments