Skip to content

Commit

Permalink
Add small test for SSH defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
martina-if committed Apr 8, 2019
1 parent 85d8f92 commit 93cbd19
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions pkg/apis/eksctl.io/v1alpha4/defaults_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package v1alpha4

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("Default settings", func() {
var (
testKeyPath = "some/path/to/file.pub"
)

Context("SSH settings", func() {

It("Providing an SSH key enables SSH", func() {
testNodeGroup := NodeGroup{
SSH: SSHConfig{
Allow: false,
PublicKeyPath: &testKeyPath,
},
}

SetNodeGroupDefaults(0, &testNodeGroup)

Expect(testNodeGroup.SSH.Allow).To(BeTrue())
})

It("Enabling SSH without a key uses default key", func() {
testNodeGroup := NodeGroup{
SSH: SSHConfig{
Allow: true,
},
}

SetNodeGroupDefaults(0, &testNodeGroup)

Expect(*testNodeGroup.SSH.PublicKeyPath).To(BeIdenticalTo("~/.ssh/id_rsa.pub"))
})
})
})
4 changes: 2 additions & 2 deletions pkg/cfn/builder/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ var _ = Describe("CloudFormation template builder API", func() {
})
})

Context("NodeGroup{PrivateNetworking=false Allow=true}", func() {
Context("NodeGroup{PrivateNetworking=false SSH.Allow=true}", func() {
cfg, ng := newClusterConfigAndNodegroup(true)

ng.SSH.Allow = true
Expand Down Expand Up @@ -866,7 +866,7 @@ var _ = Describe("CloudFormation template builder API", func() {
})
})

Context("NodeGroup{PrivateNetworking=false Allow=false}", func() {
Context("NodeGroup{PrivateNetworking=false SSH.Allow=false}", func() {
cfg, ng := newClusterConfigAndNodegroup(true)

cfg.VPC = &api.ClusterVPC{
Expand Down

0 comments on commit 93cbd19

Please sign in to comment.