Skip to content

Commit

Permalink
Add encrypted EBS volumes e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
spangenberg committed Feb 12, 2019
1 parent c7e5ec1 commit 3726ece
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
33 changes: 32 additions & 1 deletion test/machines/machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,38 @@ var _ = framework.SigKubeDescribe("Machines", func() {
})

It("Can create EBS volumes", func() {
testMachineProviderSpec, err := utils.TestingMachineProviderSpecWithEBS(awsCredSecret.Name, cluster.Name)
testMachineProviderSpec, err := utils.TestingMachineProviderSpecWithEBS(awsCredSecret.Name, cluster.Name, false)
Expect(err).NotTo(HaveOccurred())
testMachine := manifests.TestingMachine(cluster.Name, cluster.Namespace, testMachineProviderSpec)
f.CreateMachineAndWait(testMachine, acw)
machinesToDelete.AddMachine(testMachine, f, acw)

volumes, err := acw.GetVolumes(testMachine)
Expect(err).NotTo(HaveOccurred())

By("Checking EBS volume mount", func() {
Expect(volumes).To(HaveKey("/dev/sda1"))
})

By("Checking EBS volume size", func() {
Expect(volumes["/dev/sda1"]["size"].(int64)).To(Equal(int64(142)))
})

By("Checking EBS volume type", func() {
Expect(volumes["/dev/sda1"]["type"].(string)).To(Equal("gp2"))
})

By("Checking only root volume get's modified", func() {
for dev, volume := range volumes {
if dev != "/dev/sda1" {
Expect(volume["size"].(int64)).ToNot(Equal(int64(142)))
}
}
})
})

It("Can create encrypted EBS volumes", func() {
testMachineProviderSpec, err := utils.TestingMachineProviderSpecWithEBS(awsCredSecret.Name, cluster.Name, true)
Expect(err).NotTo(HaveOccurred())
testMachine := manifests.TestingMachine(cluster.Name, cluster.Namespace, testMachineProviderSpec)
f.CreateMachineAndWait(testMachine, acw)
Expand Down
3 changes: 2 additions & 1 deletion test/utils/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ func TestingMachineProviderSpec(awsCredentialsSecretName string, clusterID strin
return *config, nil
}

func TestingMachineProviderSpecWithEBS(awsCredentialsSecretName string, clusterID string) (machinev1beta1.ProviderSpec, error) {
func TestingMachineProviderSpecWithEBS(awsCredentialsSecretName string, clusterID string, encrypted bool) (machinev1beta1.ProviderSpec, error) {
volumeSize := int64(142)
volumeType := "gp2"
machinePc := testingAWSMachineProviderSpec(awsCredentialsSecretName, clusterID)
machinePc.BlockDevices = []providerconfigv1.BlockDeviceMappingSpec{
{
EBS: &providerconfigv1.EBSBlockDeviceSpec{
Encrypted: &encrypted,
VolumeSize: &volumeSize,
VolumeType: &volumeType,
},
Expand Down

0 comments on commit 3726ece

Please sign in to comment.