Skip to content

Commit

Permalink
Merge pull request kubevirt#12839 from 0xFelix/virtctl-ssh-scp
Browse files Browse the repository at this point in the history
fix(tests,virtctl): Partially revert cleanups
  • Loading branch information
kubevirt-bot authored Sep 17, 2024
2 parents b7adcef + 4946b8d commit 64bc387
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions tests/virtctl/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,13 @@ var _ = Describe("[sig-compute][virtctl]SCP", decorators.SigCompute, func() {
)

It("local-ssh flag should be unavailable in virtctl", decorators.ExcludeNativeSsh, func() {
cmd := clientcmd.NewRepeatableVirtctlCommand("scp", "--local1-ssh=false")
Expect(cmd()).To(MatchError("unknown flag: --local-ssh"))
// The built virtctl binary should be tested here, therefore clientcmd.CreateCommandWithNS needs to be used.
// Running the command through NewRepeatableVirtctlCommand would test the test binary instead.
_, cmd, err := clientcmd.CreateCommandWithNS(testsuite.NamespaceTestDefault, "virtctl", "scp", "--local-ssh=false")
Expect(err).ToNot(HaveOccurred())
out, err := cmd.CombinedOutput()
Expect(err).To(HaveOccurred(), "out[%s]", string(out))
Expect(string(out)).To(Equal("unknown flag: --local-ssh\n"))
})
})

Expand Down
9 changes: 7 additions & 2 deletions tests/virtctl/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ var _ = Describe("[sig-compute][virtctl]SSH", decorators.SigCompute, func() {
)

It("local-ssh flag should be unavailable in virtctl", decorators.ExcludeNativeSsh, func() {
cmd := clientcmd.NewRepeatableVirtctlCommand("ssh", "--local-ssh=false")
Expect(cmd()).To(MatchError("unknown flag: --local-ssh"))
// The built virtctl binary should be tested here, therefore clientcmd.CreateCommandWithNS needs to be used.
// Running the command through NewRepeatableVirtctlCommand would test the test binary instead.
_, cmd, err := clientcmd.CreateCommandWithNS(testsuite.NamespaceTestDefault, "virtctl", "ssh", "--local-ssh=false")
Expect(err).ToNot(HaveOccurred())
out, err := cmd.CombinedOutput()
Expect(err).To(HaveOccurred(), "out[%s]", string(out))
Expect(string(out)).To(Equal("unknown flag: --local-ssh\n"))
})
})

0 comments on commit 64bc387

Please sign in to comment.