2013-06-27 07:33:32 -07:00
|
|
|
package vagrant
|
|
|
|
|
|
|
|
|
|
import (
|
2018-05-25 03:42:40 -07:00
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
2013-06-27 07:33:32 -07:00
|
|
|
"testing"
|
2018-05-25 03:42:40 -07:00
|
|
|
|
2020-12-17 13:29:25 -08:00
|
|
|
"github.com/hashicorp/packer-plugin-sdk/tmp"
|
2018-05-25 03:42:40 -07:00
|
|
|
"github.com/stretchr/testify/assert"
|
2013-06-27 07:33:32 -07:00
|
|
|
)
|
|
|
|
|
|
2013-12-19 13:22:46 -08:00
|
|
|
func TestVBoxProvider_impl(t *testing.T) {
|
|
|
|
|
var _ Provider = new(VBoxProvider)
|
2013-06-27 07:33:32 -07:00
|
|
|
}
|
2018-05-25 03:42:40 -07:00
|
|
|
|
|
|
|
|
func TestDecomressOVA(t *testing.T) {
|
2018-12-12 15:45:00 +01:00
|
|
|
td, err := tmp.Dir("pp-vagrant-virtualbox")
|
2018-05-25 03:42:40 -07:00
|
|
|
assert.NoError(t, err)
|
2018-12-12 15:45:00 +01:00
|
|
|
defer os.RemoveAll(td)
|
|
|
|
|
|
2020-12-17 14:41:36 -08:00
|
|
|
fixture := "./test-fixtures/decompress-tar/outside_parent.tar"
|
2018-05-25 03:42:40 -07:00
|
|
|
err = DecompressOva(td, fixture)
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
_, err = os.Stat(filepath.Join(filepath.Base(td), "demo.poc"))
|
|
|
|
|
assert.Error(t, err)
|
|
|
|
|
_, err = os.Stat(filepath.Join(td, "demo.poc"))
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
}
|