Merge pull request #70243 from runcom/test-output-useful

test/e2e/storage: fix output in case of failure and use another NFS mount option
This commit is contained in:
k8s-ci-robot 2018-10-25 15:25:46 -07:00 committed by GitHub
commit 35290b2207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -88,7 +88,7 @@ func InitNFSDriver() TestDriver {
SupportedFsType: sets.NewString(
"", // Default fsType
),
SupportedMountOption: sets.NewString("proto=tcp", "nosuid"),
SupportedMountOption: sets.NewString("proto=tcp", "relatime"),
RequiredMountOption: sets.NewString("vers=4.1"),
IsPersistent: true,
IsFsGroupSupported: false,

View File

@ -279,6 +279,7 @@ func TestDynamicProvisioning(t StorageClassTest, client clientset.Interface, cla
// Get entry, get mount options at 6th word, replace brackets with commas
command += fmt.Sprintf(" && ( mount | grep 'on /mnt/test' | awk '{print $6}' | sed 's/^(/,/; s/)$/,/' | grep -q ,%s, )", option)
}
command += " || (mount | grep 'on /mnt/test'; false)"
runInPodWithVolume(client, claim.Namespace, claim.Name, t.NodeName, command)
By("checking the created volume is readable and retains data")
@ -348,6 +349,12 @@ func runInPodWithVolume(c clientset.Interface, ns, claimName, nodeName, command
pod, err := c.CoreV1().Pods(ns).Create(pod)
framework.ExpectNoError(err, "Failed to create pod: %v", err)
defer func() {
body, err := c.CoreV1().Pods(ns).GetLogs(pod.Name, &v1.PodLogOptions{}).Do().Raw()
if err != nil {
framework.Logf("Error getting logs for pod %s: %v", pod.Name, err)
} else {
framework.Logf("Pod %s has the following logs: %s", pod.Name, body)
}
framework.DeletePodOrFail(c, ns, pod.Name)
}()
framework.ExpectNoError(framework.WaitForPodSuccessInNamespaceSlow(c, pod.Name, pod.Namespace))