Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix drivers download #12

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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 <download type>.
# 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`
Expand Down
2 changes: 1 addition & 1 deletion cmd/major_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
40 changes: 34 additions & 6 deletions test/bats/download.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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/*
Expand Down