Merge pull request #8118 from alrs/fix-builder-vagrant-dropped-errors

builder/vagrant: fix dropped errors in code and tests
This commit is contained in:
Adrien Delorme 2019-09-17 15:08:01 +02:00 committed by GitHub
commit 8b5910c40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -96,7 +96,13 @@ func (d *Vagrant_2_2_Driver) Verify() error {
}
constraints, err := version.NewConstraint(VAGRANT_MIN_VERSION)
if err != nil {
return fmt.Errorf("error parsing vagrant minimum version: %v", err)
}
vers, err := d.Version()
if err != nil {
return fmt.Errorf("error getting virtualbox version: %v", err)
}
v, err := version.NewVersion(vers)
if err != nil {
return fmt.Errorf("Error figuring out Vagrant version.")

View File

@ -29,6 +29,9 @@ func TestCreateFile(t *testing.T) {
}
defer os.Remove(templatePath)
contents, err := ioutil.ReadFile(templatePath)
if err != nil {
t.Fatalf(err.Error())
}
actual := string(contents)
expected := `Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|
@ -56,6 +59,9 @@ func TestCreateFile_customSync(t *testing.T) {
}
defer os.Remove(templatePath)
contents, err := ioutil.ReadFile(templatePath)
if err != nil {
t.Fatalf(err.Error())
}
actual := string(contents)
expected := `Vagrant.configure("2") do |config|
config.vm.define "source", autostart: false do |source|