pass vSphere credentials to tests

This commit is contained in:
Michael Kuzmin 2018-10-31 01:10:57 +03:00
parent d7fcff025f
commit 43ee099ee7
3 changed files with 36 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package clone
import (
builderT "github.com/hashicorp/packer/helper/builder/testing"
commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing"
"os"
"github.com/hashicorp/packer/packer"
"testing"
@ -19,10 +20,19 @@ func TestCloneBuilderAcc_default(t *testing.T) {
}
func defaultConfig() map[string]interface{} {
username := os.Getenv("VSPHERE_USERNAME")
if username == "" {
username = "root"
}
password := os.Getenv("VSPHERE_PASSWORD")
if password == "" {
password = "jetbrains"
}
config := map[string]interface{}{
"vcenter_server": "vcenter.vsphere65.test",
"username": "root",
"password": "jetbrains",
"username": username,
"password": password,
"insecure_connection": true,
"template": "alpine",

View File

@ -2,6 +2,7 @@ package driver
import (
"fmt"
"os"
"testing"
"time"
"math/rand"
@ -11,10 +12,19 @@ import (
const TestHostName = "esxi-1.vsphere65.test"
func newTestDriver(t *testing.T) *Driver {
username := os.Getenv("VSPHERE_USERNAME")
if username == "" {
username = "root"
}
password := os.Getenv("VSPHERE_PASSWORD")
if password == "" {
password = "jetbrains"
}
d, err := NewDriver(&ConnectConfig{
VCenterServer: "vcenter.vsphere65.test",
Username: "root",
Password: "jetbrains",
Username: username,
Password: password,
InsecureConnection: true,
})
if err != nil {

View File

@ -7,6 +7,7 @@ import (
commonT "github.com/jetbrains-infra/packer-builder-vsphere/common/testing"
"github.com/vmware/govmomi/vim25/types"
"io/ioutil"
"os"
"testing"
)
@ -20,10 +21,19 @@ func TestISOBuilderAcc_default(t *testing.T) {
}
func defaultConfig() map[string]interface{} {
username := os.Getenv("VSPHERE_USERNAME")
if username == "" {
username = "root"
}
password := os.Getenv("VSPHERE_PASSWORD")
if password == "" {
password = "jetbrains"
}
config := map[string]interface{}{
"vcenter_server": "vcenter.vsphere65.test",
"username": "root",
"password": "jetbrains",
"username": username,
"password": password,
"insecure_connection": true,
"host": "esxi-1.vsphere65.test",