This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2359 from dgageot/test-vbox-version
Reject VirtualBox version<=3
- Loading branch information
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package virtualbox | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCheckVBoxManageVersionValid(t *testing.T) { | ||
var tests = []struct { | ||
version string | ||
}{ | ||
{"5.0.8r103449"}, | ||
{"5.0"}, | ||
{"5.1"}, | ||
{"4.1"}, | ||
{"4.2.0"}, | ||
{"4.3.1"}, | ||
} | ||
|
||
for _, test := range tests { | ||
err := checkVBoxManageVersion(test.version) | ||
|
||
assert.NoError(t, err) | ||
} | ||
} | ||
|
||
func TestCheckVBoxManageVersionInvalid(t *testing.T) { | ||
var tests = []struct { | ||
version string | ||
expectedError string | ||
}{ | ||
{"3.9", `We support Virtualbox starting with version 4. Your VirtualBox install is "3.9". Please upgrade at https://www.virtualbox.org`}, | ||
{"", `We support Virtualbox starting with version 4. Your VirtualBox install is "". Please upgrade at https://www.virtualbox.org`}, | ||
} | ||
|
||
for _, test := range tests { | ||
err := checkVBoxManageVersion(test.version) | ||
|
||
assert.EqualError(t, err, test.expectedError) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters