Enable logging in E2E if test fails

source: https://github.com/kubernetes/kubernetes/blob/master/test/e2e/framework/kubectl/kubectl_utils.go
kubectlLogPod function is not exposed in above code so copied it.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2019-12-18 14:11:20 +05:30
committed by mergify[bot]
parent b4f20e941c
commit 7d15992769
3 changed files with 91 additions and 0 deletions

View File

@ -60,8 +60,10 @@ func deleteCephfsPlugin() {
var _ = Describe("cephfs", func() {
f := framework.NewDefaultFramework("cephfs")
var c clientset.Interface
// deploy cephfs CSI
BeforeEach(func() {
c = f.ClientSet
updateCephfsDirPath(f.ClientSet)
createConfigMap(cephfsDirPath, f.ClientSet, f)
deployCephfsPlugin()
@ -69,6 +71,12 @@ var _ = Describe("cephfs", func() {
})
AfterEach(func() {
if CurrentGinkgoTestDescription().Failed {
// log provisoner
logsCSIPods("app=csi-cephfsplugin-provisioner", c)
// log node plugin
logsCSIPods("app=csi-cephfsplugin", c)
}
deleteCephfsPlugin()
deleteConfigMap(cephfsDirPath)
deleteResource(cephfsExamplePath + "secret.yaml")