Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: Add output flag #258

Merged
merged 10 commits into from
Mar 29, 2023
Next Next commit
use String() helps on test failures
  • Loading branch information
petersutter committed Mar 29, 2023
commit a6aa2c39c40f031869edf5bd5a3173946a89d51c
24 changes: 12 additions & 12 deletions pkg/cmd/ssh/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ var _ = Describe("SSH Command", func() {
Expect(cmd.RunE(cmd, nil)).To(Succeed())

// assert the output
Expect(logs).To(ContainSubstring(bastionName))
Expect(logs).To(ContainSubstring(bastionHostname))
Expect(out).To(ContainSubstring(bastionIP))
Expect(logs.String()).To(ContainSubstring(bastionName))
Expect(logs.String()).To(ContainSubstring(bastionHostname))
Expect(out.String()).To(ContainSubstring(bastionIP))

// assert that the bastion has been cleaned up
key := types.NamespacedName{Name: bastionName, Namespace: *testProject.Spec.Namespace}
Expand Down Expand Up @@ -357,9 +357,9 @@ var _ = Describe("SSH Command", func() {

// assert output
Expect(executedCommands).To(Equal(1))
Expect(logs).To(ContainSubstring(bastionName))
Expect(logs).To(ContainSubstring(bastionHostname))
Expect(out).To(ContainSubstring(bastionIP))
Expect(logs.String()).To(ContainSubstring(bastionName))
Expect(logs.String()).To(ContainSubstring(bastionHostname))
Expect(out.String()).To(ContainSubstring(bastionIP))

// assert that the bastion has been cleaned up
key := types.NamespacedName{Name: bastionName, Namespace: *testProject.Spec.Namespace}
Expand Down Expand Up @@ -411,10 +411,10 @@ var _ = Describe("SSH Command", func() {

// assert output
Expect(executedCommands).To(Equal(1))
Expect(logs).To(ContainSubstring(bastionName))
Expect(logs).To(ContainSubstring(bastionHostname))
Expect(out).To(ContainSubstring(bastionIP))
Expect(logs).To(ContainSubstring("node did not yet join the cluster"))
Expect(logs.String()).To(ContainSubstring(bastionName))
Expect(logs.String()).To(ContainSubstring(bastionHostname))
Expect(out.String()).To(ContainSubstring(bastionIP))
Expect(logs.String()).To(ContainSubstring("node did not yet join the cluster"))

// assert that the bastion has been cleaned up
key := types.NamespacedName{Name: bastionName, Namespace: *testProject.Spec.Namespace}
Expand Down Expand Up @@ -523,7 +523,7 @@ var _ = Describe("SSH Command", func() {

Expect(cmd.RunE(cmd, nil)).To(Succeed())

Expect(logs).To(ContainSubstring("Bastion is ready, skipping availability check"))
Expect(logs.String()).To(ContainSubstring("Bastion is ready, skipping availability check"))
})

It("should not keep alive the bastion", func() {
Expand All @@ -550,7 +550,7 @@ var _ = Describe("SSH Command", func() {

Expect(cmd.RunE(cmd, nil)).To(Succeed())

Expect(logs).To(ContainSubstring("Bastion host became available."))
Expect(logs.String()).To(ContainSubstring("Bastion host became available."))
})
})

Expand Down