Skip to content

Commit

Permalink
ibmcloud: Added test cases to check peer pod logs work directory
Browse files Browse the repository at this point in the history
Added test cases to check whether peer pod logs work directory while created using a custom dockerfile in ibmcloud cloud-provider

Fixes: #1045

Signed-off-by: Sudharshan Muralidharan <sudharshan.muralidharan@ibm.com>
  • Loading branch information
sudharshanibm3 authored and stevenhorsman committed Jun 21, 2023
1 parent 0e343a7 commit 79d309d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newPod(namespace string, podName string, containerName string, imageName st
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{Name: podName, Namespace: namespace},
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: containerName, Image: imageName}},
Containers: []corev1.Container{{Name: containerName, Image: imageName, ImagePullPolicy: corev1.PullAlways}},
RuntimeClassName: &runtimeClassName,
},
}
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/common_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,5 +481,15 @@ func doTestCreateConfidentialPod(t *testing.T, assert CloudAssert, testCommands
for i := 0; i < len(testCommands); i++ {
testCommands[i].containerName = pod.Spec.Containers[0].Name
}

newTestCase(t, "ConfidentialPodVM", assert, "Confidential PodVM is created").withPod(pod).withTestCommands(testCommands).run()
}

func doTestCreatePeerPodAndCheckWorkDirLogs(t *testing.T, assert CloudAssert) {
namespace := envconf.RandomName("default", 7)
podName := "workdirpod"
imageName := "quay.io/confidential-containers/test-images:testworkdir"
pod := newPod(namespace, podName, podName, imageName, withRestartPolicy(v1.RestartPolicyNever))
expectedPodLogString := "/other"
newTestCase(t, "WorkDirPeerPod", assert, "Peer pod with work directory has been created").withPod(pod).withExpectedPodLogString(expectedPodLogString).withCustomPodState(v1.PodSucceeded).run()
}
4 changes: 4 additions & 0 deletions test/e2e/fixtures/Dockerfile.testworkdir
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM --platform="${TARGETPLATFORM}" alpine:latest AS testworkdir
RUN mkdir -p /other
WORKDIR /other/
ENTRYPOINT [ "/bin/sh", "-c", "pwd" ]
7 changes: 7 additions & 0 deletions test/e2e/ibmcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ func TestCreatePeerPodAndCheckUserLogs(t *testing.T) {
doTestCreatePeerPodAndCheckUserLogs(t, assert)
}

func TestCreatePeerPodAndCheckWorkDirLogs(t *testing.T) {
assert := IBMCloudAssert{
vpc: pv.IBMCloudProps.VPC,
}
doTestCreatePeerPodAndCheckWorkDirLogs(t, assert)
}

// IBMCloudAssert implements the CloudAssert interface for ibmcloud.
type IBMCloudAssert struct {
vpc *vpcv1.VpcV1
Expand Down

0 comments on commit 79d309d

Please sign in to comment.