builder/vagrant: fix dropped errors in code and tests

This commit is contained in:
Lars Lehtonen 2019-09-17 05:39:23 -07:00
parent 1b046647ac
commit c6212731ff
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|