From db62530f7add88f4e527df2b73dde3bfed34f64e Mon Sep 17 00:00:00 2001 From: Matt Proud Date: Tue, 12 Dec 2023 14:15:51 +0000 Subject: [PATCH] bump sdk fix tests update docs --- cmd/docs.go | 9 +++++++-- cmd/major_versions.go | 2 +- go.mod | 2 +- go.sum | 2 ++ test/bats/download.bats | 40 ++++++++++++++++++++++++++++++++++------ 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/cmd/docs.go b/cmd/docs.go index 5604711..da03ebc 100644 --- a/cmd/docs.go +++ b/cmd/docs.go @@ -14,8 +14,9 @@ const ( getVersions = ` # List of available versions of sub-products vmtools of vmware_tools vcc get versions -p vmware_tools -s vmtools` - getMajorVersions = ` # List of available major versions of product vmware_tools - vcc get versions -p vmware_tools` + getMajorVersions = ` # List of available major versions of product vmware_tools. + # Only used with download types: drivers_tools, custom_isos and addons + vcc get majorversions -p vmware_tools` getFiles = ` # List of available files of version 11.3.0 of vmware_tools vcc get files -p vmware_tools -s vmtools -v 11.3.0` @@ -27,6 +28,10 @@ const ( # If using a * in the filename value, make sure to wrap the text in single quotes on linux/macos vcc download -p vmware_tools -s vmtools -v 11.* -f 'VMware-Tools-darwin-*.zip' --accepteula + # To download from from drivers_tools, custom_iso and addons, you must add -t . + # Version can be globbed, as 1 subproduct maps to 1 version, but make sure to wrap the * in a speech mark. + vcc download -p vmware_vsphere -t drivers_tools -s vs-mgmt-sdk80u2 -v '*' -f VMware-vSphere-SDK-*.zip --accepteula + # Download files using a manifest file # Show an example manifest using 'vcc get manifestexample' vcc download -m manifest.yml --accepteula` diff --git a/cmd/major_versions.go b/cmd/major_versions.go index 1d5647e..8bc9f11 100644 --- a/cmd/major_versions.go +++ b/cmd/major_versions.go @@ -16,7 +16,7 @@ var majorVersionsSlug string var MajorVersionsCmd = &cobra.Command{ Use: "majorversions", Aliases: []string{"v"}, - Short: "List available majors versions", + Short: "List available majors versions (for driver_tools, custom_iso, addons)", Long: "List available major versions to help query drives_tools, custom_isos and addons", Example: getMajorVersions, Run: func(cmd *cobra.Command, args []string) { diff --git a/go.mod b/go.mod index 731c01c..57d4747 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/orirawlings/persistent-cookiejar v0.3.2 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.1 - github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7 + github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index c5a6f52..b1bc87a 100644 --- a/go.sum +++ b/go.sum @@ -125,6 +125,8 @@ github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231207154734-713cae3 github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231207154734-713cae36dd56/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os= github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7 h1:LHS5Z0/6ssDwAQQV7iK9jqDcs6R/0BCDfBmLjdRDX0k= github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os= +github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3 h1:faIXOAHZfikmnJBUNcHj7kwIU9ByEQnOB4QwxNWNI7s= +github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= diff --git a/test/bats/download.bats b/test/bats/download.bats index 4792eae..4f69efd 100644 --- a/test/bats/download.bats +++ b/test/bats/download.bats @@ -16,22 +16,49 @@ teardown() { echo "" } -@test "download single file successfully to temp" { +@test "download driver file successfully to temp" { $VCC_CMD logout rm -f $TEMP_DIR/* - local cmd="$VCC_CMD download -p vmware_horizon_clients -s cart+andrd_x8632 -v 2106 -f VMware-Horizon-Client-AndroidOS-x86-*-store.apk --accepteula -o $TEMP_DIR" - echo $cmd - run $cmd + # command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag + run $VCC_CMD download -p vmware_vsphere -t drivers_tools -s vs-mgmt-sdk80u2 -v '*' -f VMware-vSphere-SDK-*.zip --accepteula -o $TEMP_DIR echo "$output" [[ "$output" != *"No output directory set."* ]] [[ "$output" == *"Collecting download payload"* ]] [[ "$output" == *"Download started to"* ]] [[ "$output" == *"Download finished"* ]] [ "$status" -eq 0 ] - [ -f $TEMP_DIR/VMware-Horizon-Client-*.apk ] + [ -f $TEMP_DIR/VMware-vSphere-SDK-*.zip ] } -@test "download driver file successfully to temp" { +@test "download iso file successfully to temp" { + $VCC_CMD logout + rm -f $TEMP_DIR/* + # command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag + run $VCC_CMD download -p vmware_vsphere -t custom_iso -s oem-esxi80u2-hitachi -v '*' -f VMware-ESXi-*.iso --accepteula -o $TEMP_DIR + echo "$output" + [[ "$output" != *"No output directory set."* ]] + [[ "$output" == *"Collecting download payload"* ]] + [[ "$output" == *"Download started to"* ]] + [[ "$output" == *"Download finished"* ]] + [ "$status" -eq 0 ] + [ -f $TEMP_DIR/VMware-ESXi-*.iso ] +} + +@test "download addon file successfully to temp" { + $VCC_CMD logout + rm -f $TEMP_DIR/* + # command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag + run $VCC_CMD download -p vmware_vsphere -t addons -s addon_esxi80u2_hitachi -v '*' -f VMware-ESXi-8.0*.zip --accepteula -o $TEMP_DIR + echo "$output" + [[ "$output" != *"No output directory set."* ]] + [[ "$output" == *"Collecting download payload"* ]] + [[ "$output" == *"Download started to"* ]] + [[ "$output" == *"Download finished"* ]] + [ "$status" -eq 0 ] + [ -f $TEMP_DIR/VMware-ESXi-8.0*.zip ] +} + +@test "download single file successfully to temp" { $VCC_CMD logout rm -f $TEMP_DIR/* local cmd="$VCC_CMD download -p vmware_horizon_clients -s cart+andrd_x8632 -v 2106 -f VMware-Horizon-Client-AndroidOS-x86-*-store.apk --accepteula -o $TEMP_DIR" @@ -46,6 +73,7 @@ teardown() { [ -f $TEMP_DIR/VMware-Horizon-Client-*.apk ] } + @test "re-download single file successfully to temp" { $VCC_CMD logout rm -f $TEMP_DIR/*