From 89767b69237e43c27bf951767b68727b4c6a6c42 Mon Sep 17 00:00:00 2001 From: Bryan Peterson Date: Sun, 14 Oct 2018 01:19:49 -0400 Subject: [PATCH] Add get cluster integration test Adding an integration test for listing the active clusters, ensuring the previously created cluster is listed and exit code != 0. Issue #208 --- .../create_get_delete/integration_test.go | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/integration/create_get_delete/integration_test.go b/tests/integration/create_get_delete/integration_test.go index edfdb82e8b..425dbb3fb5 100644 --- a/tests/integration/create_get_delete/integration_test.go +++ b/tests/integration/create_get_delete/integration_test.go @@ -30,6 +30,7 @@ import ( const ( createTimeout = 20 deleteTimeout = 10 + getTimeout = 1 region = "us-west-2" ) @@ -187,6 +188,31 @@ var _ = Describe("Create (Integration)", func() { }) }) + Describe("when listing clusters", func() { + var ( + err error + session *gexec.Session + ) + + It("should not return an error", func() { + args := []string{"get", "cluster", "--region", region} + + command := exec.Command(eksctlPath, args...) + session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) + + if err != nil { + Fail(fmt.Sprintf("error starting process: %v", err), 1) + } + + session.Wait(getTimeout * time.Minute) + Expect(session.ExitCode()).Should(Equal(0)) + }) + + It("should return the previously created cluster", func() { + Expect(string(session.Buffer().Contents())).To(ContainSubstring(clusterName)) + }) + }) + Describe("when deleting a cluster", func() { var ( err error