How to use downloadURL method of asset Package

Best Syzkaller code snippet using asset.downloadURL

release_test.go

Source:release_test.go Github

copy

Full Screen

...51 repo string52 tag string53 goos string54 goarch string55 downloadURL string56 binaryName string57 }{58 // aquasecurity/tfsec59 {60 owner: "aquasecurity",61 repo: "tfsec",62 tag: "v1.1.5",63 goos: "linux",64 goarch: "amd64",65 downloadURL: "https://github.com/aquasecurity/tfsec/releases/download/v1.1.5/tfsec-linux-amd64",66 binaryName: "tfsec",67 },68 {69 owner: "aquasecurity",70 repo: "tfsec",71 tag: "v1.1.5",72 goos: "darwin",73 goarch: "amd64",74 downloadURL: "https://github.com/aquasecurity/tfsec/releases/download/v1.1.5/tfsec-darwin-amd64",75 binaryName: "tfsec",76 },77 {78 owner: "aquasecurity",79 repo: "tfsec",80 tag: "v1.1.5",81 goos: "windows",82 goarch: "amd64",83 downloadURL: "https://github.com/aquasecurity/tfsec/releases/download/v1.1.5/tfsec-windows-amd64.exe",84 binaryName: "tfsec.exe",85 },86 // aquasecurity/trivy87 {88 owner: "aquasecurity",89 repo: "trivy",90 tag: "v0.17.2",91 goos: "linux",92 goarch: "amd64",93 downloadURL: "https://github.com/aquasecurity/trivy/releases/download/v0.17.2/trivy_0.17.2_Linux-64bit.tar.gz",94 binaryName: "trivy",95 },96 {97 owner: "aquasecurity",98 repo: "trivy",99 tag: "v0.17.2",100 goos: "darwin",101 goarch: "amd64",102 downloadURL: "https://github.com/aquasecurity/trivy/releases/download/v0.17.2/trivy_0.17.2_macOS-64bit.tar.gz",103 binaryName: "trivy",104 },105 // argoproj/argo-workflows106 {107 owner: "argoproj",108 repo: "argo-workflows",109 tag: "v3.0.7",110 goos: "linux",111 goarch: "amd64",112 downloadURL: "https://github.com/argoproj/argo-workflows/releases/download/v3.0.7/argo-linux-amd64.gz",113 binaryName: "argo",114 },115 {116 owner: "argoproj",117 repo: "argo-workflows",118 tag: "v3.0.7",119 goos: "darwin",120 goarch: "amd64",121 downloadURL: "https://github.com/argoproj/argo-workflows/releases/download/v3.0.7/argo-darwin-amd64.gz",122 binaryName: "argo",123 },124 {125 owner: "argoproj",126 repo: "argo-workflows",127 tag: "v3.0.7",128 goos: "windows",129 goarch: "amd64",130 downloadURL: "https://github.com/argoproj/argo-workflows/releases/download/v3.0.7/argo-windows-amd64.gz",131 binaryName: "argo.exe",132 },133 // argoproj/argo-cd134 {135 owner: "argoproj",136 repo: "argo-cd",137 tag: "v2.0.4",138 goos: "linux",139 goarch: "amd64",140 downloadURL: "https://github.com/argoproj/argo-cd/releases/download/v2.0.4/argocd-linux-amd64",141 binaryName: "argocd",142 },143 {144 owner: "argoproj",145 repo: "argo-cd",146 tag: "v2.0.4",147 goos: "darwin",148 goarch: "amd64",149 downloadURL: "https://github.com/argoproj/argo-cd/releases/download/v2.0.4/argocd-darwin-amd64",150 binaryName: "argocd",151 },152 {153 owner: "argoproj",154 repo: "argo-cd",155 tag: "v2.0.4",156 goos: "windows",157 goarch: "amd64",158 downloadURL: "https://github.com/argoproj/argo-cd/releases/download/v2.0.4/argocd-windows-amd64.exe",159 binaryName: "argocd.exe",160 },161 // argoproj/argo-rollouts162 {163 owner: "argoproj",164 repo: "argo-rollouts",165 tag: "v0.9.0",166 goos: "linux",167 goarch: "amd64",168 downloadURL: "https://github.com/argoproj/argo-rollouts/releases/download/v0.9.0/kubectl-argo-rollouts-linux-amd64",169 binaryName: "kubectl-argo-rollouts",170 },171 {172 owner: "argoproj",173 repo: "argo-rollouts",174 tag: "v0.9.0",175 goos: "darwin",176 goarch: "amd64",177 downloadURL: "https://github.com/argoproj/argo-rollouts/releases/download/v0.9.0/kubectl-argo-rollouts-darwin-amd64",178 binaryName: "kubectl-argo-rollouts",179 },180 // aws/amazon-ec2-instance-selector181 {182 owner: "aws",183 repo: "amazon-ec2-instance-selector",184 tag: "v2.0.2",185 goos: "linux",186 goarch: "amd64",187 downloadURL: "https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.0.2/ec2-instance-selector-linux-amd64",188 binaryName: "ec2-instance-selector",189 },190 {191 owner: "aws",192 repo: "amazon-ec2-instance-selector",193 tag: "v2.0.2",194 goos: "darwin",195 goarch: "amd64",196 downloadURL: "https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.0.2/ec2-instance-selector-darwin-amd64",197 binaryName: "ec2-instance-selector",198 },199 {200 owner: "aws",201 repo: "amazon-ec2-instance-selector",202 tag: "v2.0.2",203 goos: "windows",204 goarch: "amd64",205 downloadURL: "https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.0.2/ec2-instance-selector-windows-amd64",206 binaryName: "ec2-instance-selector.exe",207 },208 // buildpacks/pack209 {210 owner: "buildpacks",211 repo: "pack",212 tag: "v0.19.0",213 goos: "linux",214 goarch: "amd64",215 downloadURL: "https://github.com/buildpacks/pack/releases/download/v0.19.0/pack-v0.19.0-linux.tgz",216 binaryName: "pack",217 },218 {219 owner: "buildpacks",220 repo: "pack",221 tag: "v0.19.0",222 goos: "darwin",223 goarch: "amd64",224 downloadURL: "https://github.com/buildpacks/pack/releases/download/v0.19.0/pack-v0.19.0-macos.tgz",225 binaryName: "pack",226 },227 {228 owner: "buildpacks",229 repo: "pack",230 tag: "v0.19.0",231 goos: "windows",232 goarch: "amd64",233 downloadURL: "https://github.com/buildpacks/pack/releases/download/v0.19.0/pack-v0.19.0-windows.zip",234 binaryName: "pack.exe",235 },236 // CircleCI-Public/circleci-cli237 {238 owner: "CircleCI-Public",239 repo: "circleci-cli",240 tag: "v0.1.8764",241 goos: "linux",242 goarch: "amd64",243 downloadURL: "https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.8764/circleci-cli_0.1.8764_linux_amd64.tar.gz",244 binaryName: "circleci",245 },246 {247 owner: "CircleCI-Public",248 repo: "circleci-cli",249 tag: "v0.1.8764",250 goos: "darwin",251 goarch: "amd64",252 downloadURL: "https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.8764/circleci-cli_0.1.8764_darwin_amd64.tar.gz",253 binaryName: "circleci",254 },255 {256 owner: "CircleCI-Public",257 repo: "circleci-cli",258 tag: "v0.1.8764",259 goos: "windows",260 goarch: "amd64",261 downloadURL: "https://github.com/CircleCI-Public/circleci-cli/releases/download/v0.1.8764/circleci-cli_0.1.8764_windows_amd64.zip",262 binaryName: "circleci.exe",263 },264 // cli/cli265 {266 owner: "cli",267 repo: "cli",268 tag: "v1.12.0",269 goos: "linux",270 goarch: "amd64",271 downloadURL: "https://github.com/cli/cli/releases/download/v1.12.0/gh_1.12.0_linux_amd64.tar.gz",272 binaryName: "gh",273 },274 {275 owner: "cli",276 repo: "cli",277 tag: "v1.12.0",278 goos: "darwin",279 goarch: "amd64",280 downloadURL: "https://github.com/cli/cli/releases/download/v1.12.0/gh_1.12.0_macOS_amd64.tar.gz",281 binaryName: "gh",282 },283 {284 owner: "cli",285 repo: "cli",286 tag: "v1.12.0",287 goos: "windows",288 goarch: "amd64",289 downloadURL: "https://github.com/cli/cli/releases/download/v1.12.0/gh_1.12.0_windows_amd64.zip",290 binaryName: "gh.exe",291 },292 // docker/compose293 {294 owner: "docker",295 repo: "compose",296 tag: "1.25.4",297 goos: "linux",298 goarch: "amd64",299 downloadURL: "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-Linux-x86_64",300 binaryName: "docker-compose",301 },302 {303 owner: "docker",304 repo: "compose",305 tag: "1.25.4",306 goos: "darwin",307 goarch: "amd64",308 downloadURL: "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-Darwin-x86_64",309 binaryName: "docker-compose",310 },311 {312 owner: "docker",313 repo: "compose",314 tag: "1.25.4",315 goos: "windows",316 goarch: "amd64",317 downloadURL: "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-Windows-x86_64.exe",318 binaryName: "docker-compose.exe",319 },320 // docker/machine321 {322 owner: "docker",323 repo: "machine",324 tag: "v0.16.2",325 goos: "linux",326 goarch: "amd64",327 downloadURL: "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-Linux-x86_64",328 binaryName: "docker-machine",329 },330 {331 owner: "docker",332 repo: "machine",333 tag: "v0.16.2",334 goos: "darwin",335 goarch: "amd64",336 downloadURL: "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-Darwin-x86_64",337 binaryName: "docker-machine",338 },339 {340 owner: "docker",341 repo: "machine",342 tag: "v0.16.2",343 goos: "windows",344 goarch: "amd64",345 downloadURL: "https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-Windows-x86_64.exe",346 binaryName: "docker-machine.exe",347 },348 // docker/scan-cli-plugin349 {350 owner: "docker",351 repo: "scan-cli-plugin",352 tag: "v0.17.0",353 goos: "linux",354 goarch: "amd64",355 downloadURL: "https://github.com/docker/scan-cli-plugin/releases/download/v0.17.0/docker-scan_linux_amd64",356 binaryName: "docker-scan",357 },358 {359 owner: "docker",360 repo: "scan-cli-plugin",361 tag: "v0.17.0",362 goos: "darwin",363 goarch: "amd64",364 downloadURL: "https://github.com/docker/scan-cli-plugin/releases/download/v0.17.0/docker-scan_darwin_amd64",365 binaryName: "docker-scan",366 },367 {368 owner: "docker",369 repo: "scan-cli-plugin",370 tag: "v0.17.0",371 goos: "windows",372 goarch: "amd64",373 downloadURL: "https://github.com/docker/scan-cli-plugin/releases/download/v0.17.0/docker-scan_windows_amd64.exe",374 binaryName: "docker-scan.exe",375 },376 // fluxcd/flux2377 {378 owner: "fluxcd",379 repo: "flux2",380 tag: "v0.8.0",381 goos: "linux",382 goarch: "amd64",383 downloadURL: "https://github.com/fluxcd/flux2/releases/download/v0.8.0/flux_0.8.0_linux_amd64.tar.gz",384 binaryName: "flux",385 },386 {387 owner: "fluxcd",388 repo: "flux2",389 tag: "v0.8.0",390 goos: "darwin",391 goarch: "amd64",392 downloadURL: "https://github.com/fluxcd/flux2/releases/download/v0.8.0/flux_0.8.0_darwin_amd64.tar.gz",393 binaryName: "flux",394 },395 {396 owner: "fluxcd",397 repo: "flux2",398 tag: "v0.8.0",399 goos: "windows",400 goarch: "amd64",401 downloadURL: "https://github.com/fluxcd/flux2/releases/download/v0.8.0/flux_0.8.0_windows_amd64.zip",402 binaryName: "flux.exe",403 },404 // goodwithtech/dockle405 {406 owner: "goodwithtech",407 repo: "dockle",408 tag: "v0.3.1",409 goos: "linux",410 goarch: "amd64",411 downloadURL: "https://github.com/goodwithtech/dockle/releases/download/v0.3.1/dockle_0.3.1_Linux-64bit.tar.gz",412 binaryName: "dockle",413 },414 {415 owner: "goodwithtech",416 repo: "dockle",417 tag: "v0.3.1",418 goos: "darwin",419 goarch: "amd64",420 downloadURL: "https://github.com/goodwithtech/dockle/releases/download/v0.3.1/dockle_0.3.1_macOS-64bit.tar.gz",421 binaryName: "dockle",422 },423 {424 owner: "goodwithtech",425 repo: "dockle",426 tag: "v0.3.1",427 goos: "windows",428 goarch: "amd64",429 downloadURL: "https://github.com/goodwithtech/dockle/releases/download/v0.3.1/dockle_0.3.1_Windows-64bit.zip",430 binaryName: "dockle.exe",431 },432 // gravitational/teleport433 {434 owner: "gravitational",435 repo: "teleport",436 tag: "v8.1.0",437 goos: "linux",438 goarch: "amd64",439 downloadURL: "https://get.gravitational.com/teleport-v8.1.0-linux-amd64-bin.tar.gz",440 binaryName: "tsh",441 },442 {443 owner: "gravitational",444 repo: "teleport",445 tag: "v8.1.0",446 goos: "darwin",447 goarch: "amd64",448 downloadURL: "https://get.gravitational.com/teleport-v8.1.0-darwin-amd64-bin.tar.gz",449 binaryName: "tsh",450 },451 {452 owner: "gravitational",453 repo: "teleport",454 tag: "v8.1.0",455 goos: "windows",456 goarch: "amd64",457 downloadURL: "https://get.gravitational.com/teleport-v8.1.0-windows-amd64-bin.zip",458 binaryName: "tsh.exe",459 },460 // hashicorp/terraform461 {462 owner: "hashicorp",463 repo: "terraform",464 tag: "v0.12.20",465 goos: "linux",466 goarch: "amd64",467 downloadURL: "https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_linux_amd64.zip",468 binaryName: "terraform",469 },470 {471 owner: "hashicorp",472 repo: "terraform",473 tag: "v0.12.20",474 goos: "darwin",475 goarch: "amd64",476 downloadURL: "https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_darwin_amd64.zip",477 binaryName: "terraform",478 },479 {480 owner: "hashicorp",481 repo: "terraform",482 tag: "v0.12.20",483 goos: "windows",484 goarch: "amd64",485 downloadURL: "https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_windows_amd64.zip",486 binaryName: "terraform.exe",487 },488 // helm/helm489 {490 owner: "helm",491 repo: "helm",492 tag: "v3.1.0",493 goos: "linux",494 goarch: "amd64",495 downloadURL: "https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz",496 binaryName: "helm",497 },498 {499 owner: "helm",500 repo: "helm",501 tag: "v3.1.0",502 goos: "darwin",503 goarch: "amd64",504 downloadURL: "https://get.helm.sh/helm-v3.1.0-darwin-amd64.tar.gz",505 binaryName: "helm",506 },507 {508 owner: "helm",509 repo: "helm",510 tag: "v3.1.0",511 goos: "windows",512 goarch: "amd64",513 downloadURL: "https://get.helm.sh/helm-v3.1.0-windows-amd64.zip",514 binaryName: "helm.exe",515 },516 // istio/istio517 {518 owner: "istio",519 repo: "istio",520 tag: "1.6.0",521 goos: "linux",522 goarch: "amd64",523 downloadURL: "https://github.com/istio/istio/releases/download/1.6.0/istioctl-1.6.0-linux-amd64.tar.gz",524 binaryName: "istioctl",525 },526 {527 owner: "istio",528 repo: "istio",529 tag: "1.6.0",530 goos: "darwin",531 goarch: "amd64",532 downloadURL: "https://github.com/istio/istio/releases/download/1.6.0/istioctl-1.6.0-osx.tar.gz",533 binaryName: "istioctl",534 },535 {536 owner: "istio",537 repo: "istio",538 tag: "1.6.0",539 goos: "windows",540 goarch: "amd64",541 downloadURL: "https://github.com/istio/istio/releases/download/1.6.0/istioctl-1.6.0-win.zip",542 binaryName: "istioctl.exe",543 },544 // mikefarah/yq545 {546 owner: "mikefarah",547 repo: "yq",548 tag: "v4.7.1",549 goos: "linux",550 goarch: "amd64",551 downloadURL: "https://github.com/mikefarah/yq/releases/download/v4.7.1/yq_linux_amd64",552 binaryName: "yq",553 },554 {555 owner: "mikefarah",556 repo: "yq",557 tag: "v4.7.1",558 goos: "darwin",559 goarch: "amd64",560 downloadURL: "https://github.com/mikefarah/yq/releases/download/v4.7.1/yq_darwin_amd64",561 binaryName: "yq",562 },563 {564 owner: "mikefarah",565 repo: "yq",566 tag: "v4.7.1",567 goos: "windows",568 goarch: "amd64",569 downloadURL: "https://github.com/mikefarah/yq/releases/download/v4.7.1/yq_windows_amd64.exe",570 binaryName: "yq.exe",571 },572 // mozilla/sops573 {574 owner: "mozilla",575 repo: "sops",576 tag: "v3.5.0",577 goos: "linux",578 goarch: "amd64",579 downloadURL: "https://github.com/mozilla/sops/releases/download/v3.5.0/sops-v3.5.0.linux",580 binaryName: "sops",581 },582 {583 owner: "mozilla",584 repo: "sops",585 tag: "v3.5.0",586 goos: "darwin",587 goarch: "amd64",588 downloadURL: "https://github.com/mozilla/sops/releases/download/v3.5.0/sops-v3.5.0.darwin",589 binaryName: "sops",590 },591 {592 owner: "mozilla",593 repo: "sops",594 tag: "v3.5.0",595 goos: "windows",596 goarch: "amd64",597 downloadURL: "https://github.com/mozilla/sops/releases/download/v3.5.0/sops-v3.5.0.exe",598 binaryName: "sops.exe",599 },600 // open-policy-agent/conftest601 {602 owner: "open-policy-agent",603 repo: "conftest",604 tag: "v0.21.0",605 goos: "linux",606 goarch: "amd64",607 downloadURL: "https://github.com/open-policy-agent/conftest/releases/download/v0.21.0/conftest_0.21.0_Linux_x86_64.tar.gz",608 binaryName: "conftest",609 },610 {611 owner: "open-policy-agent",612 repo: "conftest",613 tag: "v0.21.0",614 goos: "darwin",615 goarch: "amd64",616 downloadURL: "https://github.com/open-policy-agent/conftest/releases/download/v0.21.0/conftest_0.21.0_Darwin_x86_64.tar.gz",617 binaryName: "conftest",618 },619 {620 owner: "open-policy-agent",621 repo: "conftest",622 tag: "v0.21.0",623 goos: "windows",624 goarch: "amd64",625 downloadURL: "https://github.com/open-policy-agent/conftest/releases/download/v0.21.0/conftest_0.21.0_Windows_x86_64.zip",626 binaryName: "conftest.exe",627 },628 // open-policy-agent/opa629 {630 owner: "open-policy-agent",631 repo: "opa",632 tag: "v0.29.4",633 goos: "linux",634 goarch: "amd64",635 downloadURL: "https://github.com/open-policy-agent/opa/releases/download/v0.29.4/opa_linux_amd64",636 binaryName: "opa",637 },638 {639 owner: "open-policy-agent",640 repo: "opa",641 tag: "v0.29.4",642 goos: "darwin",643 goarch: "amd64",644 downloadURL: "https://github.com/open-policy-agent/opa/releases/download/v0.29.4/opa_darwin_amd64",645 binaryName: "opa",646 },647 {648 owner: "open-policy-agent",649 repo: "opa",650 tag: "v0.29.4",651 goos: "windows",652 goarch: "amd64",653 downloadURL: "https://github.com/open-policy-agent/opa/releases/download/v0.29.4/opa_windows_amd64.exe",654 binaryName: "opa.exe",655 },656 // protocolbuffers/protobuf657 {658 owner: "protocolbuffers",659 repo: "protobuf",660 tag: "v3.11.4",661 goos: "linux",662 goarch: "amd64",663 downloadURL: "https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-linux-x86_64.zip",664 binaryName: "protoc",665 },666 {667 owner: "protocolbuffers",668 repo: "protobuf",669 tag: "v3.11.4",670 goos: "darwin",671 goarch: "amd64",672 downloadURL: "https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-osx-x86_64.zip",673 binaryName: "protoc",674 },675 {676 owner: "protocolbuffers",677 repo: "protobuf",678 tag: "v3.11.4",679 goos: "windows",680 goarch: "amd64",681 downloadURL: "https://github.com/protocolbuffers/protobuf/releases/download/v3.11.4/protoc-3.11.4-win64.zip",682 binaryName: "protoc.exe",683 },684 // starship/starship685 {686 owner: "starship",687 repo: "starship",688 tag: "v0.47.0",689 goos: "linux",690 goarch: "amd64",691 downloadURL: "https://github.com/starship/starship/releases/download/v0.47.0/starship-x86_64-unknown-linux-gnu.tar.gz",692 binaryName: "starship",693 },694 {695 owner: "starship",696 repo: "starship",697 tag: "v0.47.0",698 goos: "darwin",699 goarch: "amd64",700 downloadURL: "https://github.com/starship/starship/releases/download/v0.47.0/starship-x86_64-apple-darwin.tar.gz",701 binaryName: "starship",702 },703 {704 owner: "starship",705 repo: "starship",706 tag: "v0.47.0",707 goos: "windows",708 goarch: "amd64",709 downloadURL: "https://github.com/starship/starship/releases/download/v0.47.0/starship-x86_64-pc-windows-msvc.zip",710 binaryName: "starship.exe",711 },712 // viaduct-ai/kustomize-sops713 {714 owner: "viaduct-ai",715 repo: "kustomize-sops",716 tag: "v2.3.3",717 goos: "linux",718 goarch: "amd64",719 downloadURL: "https://github.com/viaduct-ai/kustomize-sops/releases/download/v2.3.3/ksops_2.3.3_Linux_x86_64.tar.gz",720 binaryName: "ksops",721 },722 {723 owner: "viaduct-ai",724 repo: "kustomize-sops",725 tag: "v2.3.3",726 goos: "darwin",727 goarch: "amd64",728 downloadURL: "https://github.com/viaduct-ai/kustomize-sops/releases/download/v2.3.3/ksops_2.3.3_Darwin_x86_64.tar.gz",729 binaryName: "ksops",730 },731 {732 owner: "viaduct-ai",733 repo: "kustomize-sops",734 tag: "v2.3.3",735 goos: "windows",736 goarch: "amd64",737 downloadURL: "https://github.com/viaduct-ai/kustomize-sops/releases/download/v2.3.3/ksops_2.3.3_Windows_x86_64.tar.gz",738 binaryName: "ksops.exe",739 },740 }741 token := os.Getenv("GITHUB_TOKEN")742 c, err := NewClient(token)743 if err != nil {744 t.Fatal(err)745 }746 for _, tt := range tests {747 name := fmt.Sprintf("%s/%s", tt.owner, tt.repo)748 t.Run(name, func(t *testing.T) {749 repo, err := c.Repository(tt.owner, tt.repo)750 if err != nil {751 t.Fatal(err)752 }753 release, err := repo.Release(tt.tag)754 if err != nil {755 t.Fatal(err)756 }757 asset, err := release.AssetByPlatform(tt.goos, tt.goarch)758 if err != nil {759 t.Fatal(err)760 }761 if asset.DownloadURL() != tt.downloadURL {762 t.Fatalf("Expected is %s but actual is %s", tt.downloadURL, asset.DownloadURL())763 }764 binaryName, err := asset.BinaryName()765 if err != nil {766 t.Fatal(err)767 }768 if binaryName != tt.binaryName {769 t.Fatalf("Expected is %s but actual is %s", tt.binaryName, binaryName)770 }771 if !asset.ContainReleaseBinary() {772 t.Fatalf("Asset does not contain release binary")773 }774 })775 }776}...

Full Screen

Full Screen

asset_lister.go

Source:asset_lister.go Github

copy

Full Screen

...63 result = append(result, &asset{64 client: l.client,65 repo: l.repo,66 release: l.release,67 downloadURL: a.GetBrowserDownloadURL(),68 })69 }70 return result, nil71}72// terraformAssetLister is asset lister for hashicorp/terraform73type terraformAssetLister struct {74 client *client75 repo *repository76 release *release77}78// List assets in hashicorp/terraform79func (l *terraformAssetLister) List() ([]Asset, error) {80 baseURL, err := url.Parse("https://releases.hashicorp.com")81 if err != nil {82 return nil, err83 }84 baseURL.Path = path.Join(baseURL.Path, "terraform", l.release.Version())85 res, err := http.Get(baseURL.String())86 if err != nil {87 return nil, err88 }89 defer res.Body.Close()90 if res.StatusCode != 200 {91 return nil, fmt.Errorf("status code error: %d %s", res.StatusCode, res.Status)92 }93 doc, err := goquery.NewDocumentFromReader(res.Body)94 if err != nil {95 return nil, err96 }97 assetNames := []string{}98 doc.Find("li").Each(func(i int, s *goquery.Selection) {99 assetName := s.Find("a").Text()100 if assetName != "../" {101 assetNames = append(assetNames, assetName)102 }103 })104 results := []Asset{}105 for _, assetName := range assetNames {106 downloadURL, err := url.Parse(baseURL.String())107 if err != nil {108 return nil, err109 }110 downloadURL.Path = path.Join(downloadURL.Path, assetName)111 results = append(results, &asset{112 client: l.client,113 repo: l.repo,114 release: l.release,115 downloadURL: downloadURL.String(),116 })117 }118 return results, nil119}120// helmAssetLister is asset lister for helm/helm121type helmAssetLister struct {122 client *client123 repo *repository124 release *release125}126// List assets in helm/helm127func (l *helmAssetLister) List() ([]Asset, error) {128 baseURL, err := url.Parse("https://get.helm.sh")129 if err != nil {130 return nil, err131 }132 gLister := &githubAssetLister{133 client: l.client,134 repo: l.repo,135 release: l.release,136 }137 assets, err := gLister.List()138 if err != nil {139 return nil, err140 }141 result := []Asset{}142 for _, a := range assets {143 assetName := strings.TrimRight(a.Name(), ".asc")144 if strings.Contains(assetName, "sha256") {145 continue146 }147 downloadURL, err := url.Parse(baseURL.String())148 if err != nil {149 return nil, err150 }151 downloadURL.Path = path.Join(downloadURL.Path, assetName)152 result = append(result, &asset{153 client: l.client,154 repo: l.repo,155 release: l.release,156 downloadURL: downloadURL.String(),157 })158 }159 return result, nil160}161// teleportAssetLister is asset lister for gravitational/teleport162type teleportAssetLister struct {163 client *client164 repo *repository165 release *release166}167// TeleportReleasesResponse is response from https://dashboard.gravitational.com/webapi/releases-oss168type TeleportReleasesResponse struct {169 Next int `json:"next"`170 Last int `json:"last"`171 Items []TeleportRelease `json:"items"`172}173// TeleportRelease is part of response from https://dashboard.gravitational.com/webapi/releases-oss174type TeleportRelease struct {175 Version string `json:"version"`176 Downloads []TeleportAsset `json:"downloads"`177}178// TeleportAsset is part of response from https://dashboard.gravitational.com/webapi/releases-oss179type TeleportAsset struct {180 URL string `json:"url"`181}182// List assets in gravitational/teleport183func (l *teleportAssetLister) List() ([]Asset, error) {184 var teleportRelease TeleportRelease185 found := false186 page := 0187 for {188 req, err := http.NewRequest("GET", "https://dashboard.gravitational.com/webapi/releases-oss", nil)189 if err != nil {190 return nil, err191 }192 params := req.URL.Query()193 params.Add("product", "teleport")194 params.Add("page", fmt.Sprintf("%d", page))195 req.URL.RawQuery = params.Encode()196 client := &http.Client{}197 res, err := client.Do(req)198 if err != nil {199 return nil, err200 }201 defer res.Body.Close()202 if res.StatusCode != 200 {203 return nil, fmt.Errorf("status code error: %d %s", res.StatusCode, res.Status)204 }205 var response TeleportReleasesResponse206 body, err := ioutil.ReadAll(res.Body)207 if err != nil {208 return nil, err209 }210 err = json.Unmarshal(body, &response)211 if err != nil {212 return nil, err213 }214 for _, tr := range response.Items {215 if tr.Version == l.release.Tag() {216 teleportRelease = tr217 found = true218 break219 }220 }221 if found || response.Last == page {222 break223 }224 page = response.Next225 }226 if !found {227 return nil, fmt.Errorf("no teleport release found")228 }229 result := []Asset{}230 for _, a := range teleportRelease.Downloads {231 result = append(result, &asset{232 client: l.client,233 repo: l.repo,234 release: l.release,235 downloadURL: a.URL,236 })237 }238 return result, nil239}...

Full Screen

Full Screen

client_test.go

Source:client_test.go Github

copy

Full Screen

1package client2import (3 "nexus-pusher/internal/core"4 "reflect"5 "testing"6)7func Test_fileNameFromPath(t *testing.T) {8 type args struct {9 path string10 }11 tests := []struct {12 name string13 args args14 want string15 }{16 {17 name: "test1",18 args: args{path: "https://somedomain.org/url/path/file.jar"},19 want: "file.jar",20 },21 {22 name: "test2",23 args: args{path: "https://somedomain.org/url/path/@file.jar"},24 want: "file.jar",25 },26 }27 for _, tt := range tests {28 t.Run(tt.name, func(t *testing.T) {29 if got := fileNameFromPath(tt.args.path); got != tt.want {30 t.Errorf("fileNameFromPath() = %v, want %v", got, tt.want)31 }32 })33 }34}35func Test_compareComponents(t *testing.T) {36 type args struct {37 src []*core.NexusComponent38 dst []*core.NexusComponent39 }40 tests := []struct {41 name string42 args args43 want []*core.NexusComponent44 }{45 {46 name: "test1",47 args: args{src: []*core.NexusComponent{48 {49 ID: "id1",50 Repository: "repo1",51 Format: "npm",52 Group: "group1",53 Name: "name1",54 Version: "1.0",55 Assets: []*core.NexusComponentAsset{56 {57 DownloadURL: "https://some.org/file1.tar",58 Path: "https://Some.org/path/file1.tar",59 ID: "id1",60 Repository: "repo1",61 Format: "npm",62 },63 {64 DownloadURL: "https://some2.org/file2.tar",65 Path: "https://some2.org/path2/file2.tar",66 ID: "id2",67 Repository: "repo2",68 Format: "npm",69 },70 },71 },72 {73 ID: "id2",74 Repository: "repo2",75 Format: "npm",76 Group: "group2",77 Name: "name2",78 Version: "1.0",79 Assets: []*core.NexusComponentAsset{80 {81 DownloadURL: "https://some.org/file3.tar",82 Path: "https://Some.org/path/file3.tar",83 ID: "id1",84 Repository: "repo1",85 Format: "npm",86 },87 {88 DownloadURL: "https://some2.org/file4.tar",89 Path: "https://some2.org/path2/file4.tar",90 ID: "id2",91 Repository: "repo2",92 Format: "npm",93 },94 },95 },96 {97 ID: "id3",98 Repository: "repo3",99 Format: "npm",100 Group: "group3",101 Name: "name3",102 Version: "1.0",103 Assets: []*core.NexusComponentAsset{104 {105 DownloadURL: "https://some.org/file5.tar",106 Path: "https://some.org/path/file5.tar",107 ID: "id1",108 Repository: "repo1",109 Format: "npm",110 },111 {112 DownloadURL: "https://some2.org/file6.tar",113 Path: "https://some2.org/path2/file6.tar",114 ID: "id2",115 Repository: "repo2",116 Format: "npm",117 },118 },119 },120 },121 dst: []*core.NexusComponent{122 {123 ID: "id1",124 Repository: "repo1",125 Format: "npm",126 Group: "group1",127 Name: "name1",128 Version: "1.0",129 Assets: []*core.NexusComponentAsset{130 {131 DownloadURL: "https://some.org/file1.tar",132 Path: "https://some.org/path/file1.tar",133 ID: "id1",134 Repository: "repo1",135 Format: "npm",136 },137 },138 },139 {140 ID: "id2",141 Repository: "repo2",142 Format: "npm",143 Group: "group2",144 Name: "name2",145 Version: "1.0",146 Assets: []*core.NexusComponentAsset{147 {148 DownloadURL: "https://some.org/file3.tar",149 Path: "https://some.org/path/file3.tar",150 ID: "id1",151 Repository: "repo1",152 Format: "npm",153 },154 },155 },156 },157 },158 want: []*core.NexusComponent{159 {160 ID: "id1",161 Repository: "repo1",162 Format: "npm",163 Group: "group1",164 Name: "name1",165 Version: "1.0",166 Assets: []*core.NexusComponentAsset{167 {168 DownloadURL: "https://some2.org/file2.tar",169 Path: "https://some2.org/path2/file2.tar",170 ID: "id2",171 Repository: "repo2",172 Format: "npm",173 },174 },175 },176 {177 ID: "id2",178 Repository: "repo2",179 Format: "npm",180 Group: "group2",181 Name: "name2",182 Version: "1.0",183 Assets: []*core.NexusComponentAsset{184 {185 DownloadURL: "https://some2.org/file4.tar",186 Path: "https://some2.org/path2/file4.tar",187 ID: "id2",188 Repository: "repo2",189 Format: "npm",190 },191 },192 },193 {194 ID: "id3",195 Repository: "repo3",196 Format: "npm",197 Group: "group3",198 Name: "name3",199 Version: "1.0",200 Assets: []*core.NexusComponentAsset{201 {202 DownloadURL: "https://some.org/file5.tar",203 Path: "https://some.org/path/file5.tar",204 ID: "id1",205 Repository: "repo1",206 Format: "npm",207 },208 {209 DownloadURL: "https://some2.org/file6.tar",210 Path: "https://some2.org/path2/file6.tar",211 ID: "id2",212 Repository: "repo2",213 Format: "npm",214 },215 },216 },217 },218 },219 }220 for _, tt := range tests {221 t.Run(tt.name, func(t *testing.T) {222 if got := compareComponents(tt.args.src, tt.args.dst); !reflect.DeepEqual(got, tt.want) {223 t.Errorf("compareComponents() = %v, want %v", got, tt.want)224 }225 })226 }227}...

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 trace.Logger = trace.NewLogger("true")4 if len(os.Args) < 2 {5 } else {6 }7 sess, err := session.New()8 if err != nil {9 fmt.Println(err)10 }11 resourceAPI := management.New(sess)12 csAPI, err := containerv1.New(sess)13 if err != nil {14 fmt.Println(err)15 }16 workerAPI := csAPI.Workers()17 cluster, err := resourceAPI.ResourceServiceInstance().FindByName(clusterName, "containers-kubernetes")18 if err != nil {19 fmt.Println(err)20 }21 workerPools, err := workerAPI.List(cluster.ID)22 if err != nil {23 fmt.Println(err)24 }25 workerList, err := workerAPI.ListWorkers(cluster.ID, workerPool.ID)26 if err != nil {27 fmt.Println(err)28 }29 downloadURL, err := workerAPI.DownloadKubeConfig(cluster.ID, worker.ID)30 if err != nil {31 fmt.Println(err)32 }33 fmt.Println(downloadURL)34}

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2type Asset struct {3}4func NewAsset(restClient restclient.Client) Asset {5 return Asset{6 }7}8func (a Asset) downloadURL(ctx context.PluginContext, url string) (string, error) {9 locale := i18n.GetLocaleFromContext(ctx)

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 sess, err := session.New()4 if err != nil {5 fmt.Println(err)6 }7 resourceManagementAPI := management.New(sess)8 asset, err := resourceManagementAPI.Assets().FindAssetByID("assetID")9 if err != nil {10 fmt.Println(err)11 }12 downloadURL, err := asset.DownloadURL()13 if err != nil {14 fmt.Println(err)15 }16 fmt.Println(downloadURL)17}18import (19func main() {20 sess, err := session.New()21 if err != nil {22 fmt.Println(err)23 }24 resourceManagementAPI := management.New(sess)25 asset, err := resourceManagementAPI.Assets().FindAssetByID("assetID")26 if err != nil {27 fmt.Println(err)28 }29 downloadURL, err := asset.DownloadURL()30 if err != nil {31 fmt.Println(err)32 }33 fmt.Println(downloadURL)34}35import (36func main() {37 sess, err := session.New()38 if err != nil {39 fmt.Println(err)40 }

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println(asset.downloadURL())4}5import "fmt"6func main() {7 fmt.Println(asset.downloadURL())8}9import "fmt"10func main() {11 fmt.Println(asset.downloadURL())12}13import "fmt"14func main() {15 fmt.Println(asset.downloadURL())16}17import "fmt"18func main() {19 fmt.Println(asset.downloadURL())20}21import "fmt"22func main() {23 fmt.Println(asset.downloadURL())24}25import "fmt"26func main() {27 fmt.Println(asset.downloadURL())28}29import "fmt"30func main() {31 fmt.Println(asset.downloadURL())32}33import "fmt"34func main() {35 fmt.Println(asset.downloadURL())36}37import "fmt"38func main() {39 fmt.Println(asset.downloadURL())40}41import "fmt"42func main() {43 fmt.Println(asset.downloadURL())44}45import "fmt"46func main() {47 fmt.Println(asset.downloadURL())48}49import "fmt"50func main() {51 fmt.Println(asset.downloadURL())52}53import "fmt"54func main() {55 fmt.Println(asset.downloadURL

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 stub := shim.NewMockStub("asset", new(Asset))4 uuid, _ := uuid.NewV4()5 uuidString := uuid.String()6 stub.MockTransactionStart(uuidString)7 stub.MockInvoke(uuidString, [][]byte{[]byte("downloadURL"), []byte("1")})8 stub.MockTransactionEnd(uuidString)9}10import (11func main() {12 stub := shim.NewMockStub("asset", new(Asset))13 uuid, _ := uuid.NewV4()14 uuidString := uuid.String()15 stub.MockTransactionStart(uuidString)16 stub.MockInvoke(uuidString, [][]byte{[]byte("downloadURL"), []byte("2")})17 stub.MockTransactionEnd(uuidString)18}19import (20func main() {21 stub := shim.NewMockStub("asset", new(Asset))22 uuid, _ := uuid.NewV4()23 uuidString := uuid.String()24 stub.MockTransactionStart(uuidString)25 stub.MockInvoke(uuidString, [][]byte{[]byte("downloadURL"), []byte("3")})26 stub.MockTransactionEnd(uuidString)27}28import (29func main() {30 stub := shim.NewMockStub("asset", new(Asset))31 uuid, _ := uuid.NewV4()32 uuidString := uuid.String()33 stub.MockTransactionStart(uuidString)34 stub.MockInvoke(uuidString, [][]byte{[]byte("downloadURL"), []byte("4")})35 stub.MockTransactionEnd(uuidString)36}

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 m := image.NewRGBA(image.Rect(0, 0, 100, 100))4 m.Set(0, 0, color.White)5 m.Set(99, 0, color.White)6 m.Set(0, 99, color.White)7 m.Set(99, 99, color.White)8 f, err := os.Create("image.png")9 if err != nil {10 log.Fatal(err)11 }12 defer f.Close()13 err = png.Encode(f, m)14 if err != nil {15 log.Fatal(err)16 }17}18import (19func main() {20 m := image.NewRGBA(image.Rect(0, 0, 100, 100))21 m.Set(0, 0, color.White)22 m.Set(99, 0, color.White)23 m.Set(0, 99, color.White)24 m.Set(99, 99, color.White)25 f, err := os.Create("image.png")26 if err != nil {27 log.Fatal(err)28 }29 defer f.Close()30 err = png.Encode(f, m)31 if err != nil {32 log.Fatal(err)33 }34}35import (36func main() {37 m := image.NewRGBA(image.Rect(0, 0, 100, 100))38 m.Set(0, 0, color.White)39 m.Set(99, 0, color.White)40 m.Set(0, 99, color.White)41 m.Set(99, 99, color.White)

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Enter bucket name")4 fmt.Scan(&bucketName)5 fmt.Println("Enter object name")6 fmt.Scan(&objectName)7 client, err := storage.NewClient(ctx)8 if err != nil {9 log.Fatalf("Failed to create client: %v", err)10 }11 bucket := client.Bucket(bucketName)12 object := bucket.Object(objectName)13 url, err := object.SignedURL(ctx, storage.SignedURLOptions{14 Expires: time.Now().Add(24 * time.Hour),15 PrivateKey: []byte("your-private-key"),16 })17 if err != nil {18 log.Fatalf("Failed to get signed url: %v", err)19 }20 fmt.Println("URL:", url)21}

Full Screen

Full Screen

downloadURL

Using AI Code Generation

copy

Full Screen

1func main() {2 asset := Asset{3 }4 url := asset.downloadURL()5 fmt.Println(url)6}7func main() {8 asset := Asset{9 }10 url := asset.downloadURL()11 fmt.Println(url)12}13func main() {14 asset := Asset{15 }16 url := asset.downloadURL()17 fmt.Println(url)18}19func main() {20 asset := Asset{21 }22 url := asset.downloadURL()23 fmt.Println(url)24}25func main() {26 asset := Asset{27 }28 url := asset.downloadURL()29 fmt.Println(url)30}31func main() {32 asset := Asset{33 }34 url := asset.downloadURL()35 fmt.Println(url)36}37func main() {38 asset := Asset{39 }40 url := asset.downloadURL()41 fmt.Println(url)42}43func main() {44 asset := Asset{

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful