Commit 0df02517 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #45165 from dims/run-ssh-test-only-if-key-present

Automatic merge from submit-queue (batch tested with PRs 44062, 45165) Run SSH e2e test only if SSH keys are present **What this PR does / why we need it**: Not all CI systems support ssh keys to be present on the node. This supports the case where "local" provider is being used when running e2e test, but the environment does not have a SSH key. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 03c9c48c 5cd700ab
......@@ -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)
......
......@@ -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
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment