Skip to content

Commit aee4a35

Browse files
YashasG98YashwantGohokar
authored andcommitted
e2e improvements
[OKE-36695][OKE-36696] e2e logging improvements [OKE-37816] Logging improvement for RWX tests [OKE-37639] Increase slow pod start timeout in e2es [OKE-37370] Update boot volume test to clone boot volume in compartment
1 parent 1a1ebe6 commit aee4a35

File tree

4 files changed

+117
-200
lines changed

4 files changed

+117
-200
lines changed

test/e2e/cloud-provider-oci/boot_volume.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var _ = Describe("Boot volume tests", func() {
4646
opts := framework.Options{
4747
BlockProvisionerName: setupF.BlockProvisionerName,
4848
}
49-
pvc, bootvolumeId := pvcJig.CreateAndAwaitStaticBootVolumePVCOrFailCSI(f.ComputeClient, f.Namespace.Name, compartmentId, setupF.AdLocation, setupF.MntTargetSubnetOcid, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeBlock, v1.ReadWriteOnce, v1.ClaimPending, opts)
49+
pvc, bootvolumeId := pvcJig.CreateAndAwaitStaticBootVolumePVCOrFailCSI(f.ComputeClient, f.BlockStorageClient, f.Namespace.Name, compartmentId, setupF.AdLocation, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeBlock, v1.ReadWriteOnce, v1.ClaimPending, opts)
5050
f.VolumeIds = append(f.VolumeIds, pvc.Spec.VolumeName)
5151

5252
podName := pvcJig.NewPodForCSI("app1", f.Namespace.Name, pvc.Name, setupF.AdLabel, v1.PersistentVolumeBlock)
@@ -74,13 +74,10 @@ var _ = Describe("Boot volume gating test", func() {
7474
framework.Failf("Compartment Id undefined.")
7575
}
7676

77-
scName := f.CreateStorageClassOrFail(f.Namespace.Name, setupF.BlockProvisionerName,
77+
scName := f.CreateStorageClassOrFail(f.Namespace.Name, "blockvolume.csi.oraclecloud.com",
7878
map[string]string{framework.AttachmentType: framework.AttachmentTypeISCSI},
7979
pvcJig.Labels, "WaitForFirstConsumer", false, "Retain", nil)
80-
opts := framework.Options{
81-
BlockProvisionerName: setupF.BlockProvisionerName,
82-
}
83-
pvc, bootvolumeId := pvcJig.CreateAndAwaitStaticBootVolumePVCOrFailCSI(f.ComputeClient, f.Namespace.Name, compartmentId, setupF.AdLocation, setupF.MntTargetSubnetOcid, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending, opts)
80+
pvc, bootvolumeId := pvcJig.CreateAndAwaitStaticBootVolumePVCOrFailCSI(f.ComputeClient, f.BlockStorageClient, f.Namespace.Name, compartmentId, setupF.AdLocation, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
8481
pvcJig.NewPodForCSIWithoutWait("app1", f.Namespace.Name, pvc.Name, setupF.AdLabel)
8582
err := pvcJig.WaitTimeoutForPodRunningInNamespace("app1", f.Namespace.Name, 7*time.Minute)
8683
if err == nil {

test/e2e/framework/cloud_provider_framework.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,21 @@ func (f *CloudProviderFramework) AfterEach() {
343343
if len(nsDeletionErrors) != 0 {
344344
messages := []string{}
345345
for namespaceKey, namespaceErr := range nsDeletionErrors {
346+
if strings.Contains(namespaceErr.Error(), "timed out waiting for the condition") {
347+
Logf("Couldn't delete ns: %q: %s", namespaceKey, namespaceErr.Error())
348+
pods, err := f.ClientSet.CoreV1().Pods(namespaceKey).List(context.TODO(), metav1.ListOptions{})
349+
if err != nil {
350+
Logf("Failed to list pods in ns %q: %v", namespaceKey, err)
351+
} else {
352+
for _, pod := range pods.Items {
353+
if pod.DeletionTimestamp != nil {
354+
Logf("Pod %q is stuck terminating in namespace %q", pod.Name, namespaceKey)
355+
pvcJig := NewPVCTestJig(f.ClientSet, "namespace-stuck-pod-logging")
356+
pvcJig.LogPodDebugInfo(namespaceKey, pod.Name)
357+
}
358+
}
359+
}
360+
}
346361
messages = append(messages, fmt.Sprintf("Couldn't delete ns: %q: %s (%#v)", namespaceKey, namespaceErr, namespaceErr))
347362
}
348363
Failf(strings.Join(messages, ","))

test/e2e/framework/pod_util.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ func (j *PVCTestJig) CreateAndAwaitNginxPodOrFail(ns string, pvc *v1.PersistentV
408408
// Waiting for pod to be running
409409
err = j.WaitTimeoutForPodRunningInNamespace(pod.Name, ns, slowPodStartTimeout)
410410
if err != nil {
411+
Logf("Pod failed to come up, logging debug info\n")
412+
j.LogPodDebugInfo(namespace, pod.Name)
411413
Failf("Pod %q is not Running: %v", pod.Name, err)
412414
}
413415

@@ -704,10 +706,17 @@ func (j *PVCTestJig) logNodeDriverLogs(pod *v1.Pod) {
704706
}
705707
}
706708

707-
func (j *PVCTestJig) logPodDebugInfo(ns string, podName string) {
709+
func (j *PVCTestJig) LogPodDebugInfo(ns string, podName string) {
708710
pod, err := j.describePod(ns, podName)
709711
if err != nil {
710712
Logf("Error describing pod: %v", err)
713+
if apierrors.IsNotFound(err) {
714+
pods, listErr := j.KubeClient.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{})
715+
if listErr != nil {
716+
Logf("Error listing pods: %v", listErr)
717+
}
718+
Logf("Pods in namespace list: %v", pods.Items)
719+
}
711720
return
712721
}
713722

0 commit comments

Comments
 (0)