diff --git a/commandparser/construct.go b/commandparser/construct.go index 755fb26e..4702c06a 100644 --- a/commandparser/construct.go +++ b/commandparser/construct.go @@ -8,13 +8,14 @@ import ( "path/filepath" "strings" + "github.com/google/subcommands" + "github.com/vmware/govmomi/guest" + "github.com/vmware/govmomi/object" + "github.com/cloudfoundry/stembuild/construct/config" vcenterclientfactory "github.com/cloudfoundry/stembuild/iaas_cli/iaas_clients/factory" "github.com/cloudfoundry/stembuild/iaas_cli/iaas_clients/guest_manager" "github.com/cloudfoundry/stembuild/iaas_cli/iaas_clients/vcenter_manager" - "github.com/google/subcommands" - "github.com/vmware/govmomi/guest" - "github.com/vmware/govmomi/object" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate diff --git a/iaas_cli/iaas_clients/vcenter_manager/vcenter_manager.go b/iaas_cli/iaas_clients/vcenter_manager/vcenter_manager.go index ceb9731b..7cb3b93b 100644 --- a/iaas_cli/iaas_clients/vcenter_manager/vcenter_manager.go +++ b/iaas_cli/iaas_clients/vcenter_manager/vcenter_manager.go @@ -6,12 +6,13 @@ import ( "path" "strings" - "github.com/cloudfoundry/stembuild/iaas_cli/iaas_clients/guest_manager" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/guest" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/types" + + "github.com/cloudfoundry/stembuild/iaas_cli/iaas_clients/guest_manager" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate diff --git a/integration/construct/construct_suite_test.go b/integration/construct/construct_suite_test.go index cc3dc4ad..86699991 100644 --- a/integration/construct/construct_suite_test.go +++ b/integration/construct/construct_suite_test.go @@ -10,9 +10,9 @@ import ( "testing" "time" - "github.com/cloudfoundry/stembuild/remotemanager" - "github.com/cloudfoundry/stembuild/test/helpers" "github.com/concourse/pool-resource/out" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" "github.com/vmware/govmomi/govc/cli" _ "github.com/vmware/govmomi/govc/device" _ "github.com/vmware/govmomi/govc/importx" @@ -20,8 +20,8 @@ import ( _ "github.com/vmware/govmomi/govc/vm/guest" _ "github.com/vmware/govmomi/govc/vm/snapshot" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + "github.com/cloudfoundry/stembuild/remotemanager" + "github.com/cloudfoundry/stembuild/test/helpers" ) func TestConstruct(t *testing.T) { diff --git a/integration/construct/construct_test.go b/integration/construct/construct_test.go index 0db0e344..7c66b43a 100644 --- a/integration/construct/construct_test.go +++ b/integration/construct/construct_test.go @@ -6,12 +6,12 @@ import ( "path/filepath" "time" - "github.com/cloudfoundry/stembuild/test/helpers" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gexec" + + "github.com/cloudfoundry/stembuild/test/helpers" ) const ( @@ -31,6 +31,7 @@ var _ = Describe("stembuild construct", func() { AfterEach(func() { _ = os.Remove(filepath.Join(workingDir, "LGPO.zip")) }) + Context("run successfully", func() { BeforeEach(func() { err := CopyFile(filepath.Join(workingDir, "assets", "LGPO.zip"), filepath.Join(workingDir, "LGPO.zip")) diff --git a/remotemanager/winrm_rebootchecker.go b/remotemanager/winrm_rebootchecker.go index 89a7b65a..2406d9c7 100644 --- a/remotemanager/winrm_rebootchecker.go +++ b/remotemanager/winrm_rebootchecker.go @@ -45,7 +45,7 @@ func NewRebootChecker(winrmRemoteManager RemoteManager) *RebootChecker { return &RebootChecker{winrmRemoteManager} } -// Inspired by Hashicorp Packer waitForRestart +// RebootHasFinished inspired by Hashicorp Packer waitForRestart func (rc *RebootChecker) RebootHasFinished() (bool, error) { exitCode, err := rc.remoteManager.ExecuteCommand(tryCheckReboot) diff --git a/remotemanager/winrm_remotemanager_test.go b/remotemanager/winrm_remotemanager_test.go index f43b8820..2373d29d 100644 --- a/remotemanager/winrm_remotemanager_test.go +++ b/remotemanager/winrm_remotemanager_test.go @@ -9,13 +9,13 @@ import ( "net/url" "strconv" - "github.com/cloudfoundry/stembuild/remotemanager" - "github.com/cloudfoundry/stembuild/remotemanager/remotemanagerfakes" "github.com/masterzen/winrm" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/ghttp" + + "github.com/cloudfoundry/stembuild/remotemanager" + "github.com/cloudfoundry/stembuild/remotemanager/remotemanagerfakes" ) func setupTestServer() *Server { @@ -153,6 +153,7 @@ var _ = Describe("WinRM RemoteManager", func() { Expect(err).NotTo(HaveOccurred()) }) + It("returns error if winrmclient cannot be created", func() { winRMClientFactory := new(remotemanagerfakes.FakeWinRMClientFactoryI) buildError := errors.New("unable to build a client") @@ -176,7 +177,6 @@ var _ = Describe("WinRM RemoteManager", func() { Expect(err).To(HaveOccurred()) Expect(err).To(MatchError(fmt.Errorf("failed to create winrm shell: some shell creation error"))) - }) }) })