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

Run SSH e2e test only if SSH keys are present #45165

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/e2e/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,12 @@ func SkipIfProviderIs(unsupportedProviders ...string) {
}
}

func SkipUnlessSSHKeyPresent() {
if _, err := GetSigner(TestContext.Provider); err != nil {
Skipf("No SSH Key for provider %s: '%v'", TestContext.Provider, err)
}
}

func SkipUnlessProviderIs(supportedProviders ...string) {
if !ProviderIs(supportedProviders...) {
Skipf("Only supported for providers %v (not %s)", supportedProviders, TestContext.Provider)
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ var _ = framework.KubeDescribe("Services", func() {
// TODO: use the ServiceTestJig here
// this test uses framework.NodeSSHHosts that does not work if a Node only reports LegacyHostIP
framework.SkipUnlessProviderIs(framework.ProvidersWithSSH...)
// this test does not work if the Node does not support SSH Key
framework.SkipUnlessSSHKeyPresent()

ns := f.Namespace.Name
numPods, servicePort := 3, 80

Expand Down
4 changes: 4 additions & 0 deletions test/e2e/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ var _ = framework.KubeDescribe("SSH", func() {
BeforeEach(func() {
// When adding more providers here, also implement their functionality in util.go's framework.GetSigner(...).
framework.SkipUnlessProviderIs(framework.ProvidersWithSSH...)

// This test SSH's into the node for which it needs the $HOME/.ssh/id_rsa key to be present. So
// we should skip if the environment does not have the key (not all CI systems support this use case)
framework.SkipUnlessSSHKeyPresent()
})

It("should SSH to all nodes and run commands", func() {
Expand Down