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

@ -62,8 +62,10 @@ func deleteRBDPlugin() {
var _ = Describe("RBD", func() {
f := framework.NewDefaultFramework("rbd")
var c clientset.Interface
// deploy RBD CSI
BeforeEach(func() {
c = f.ClientSet
updaterbdDirPath(f.ClientSet)
createConfigMap(rbdDirPath, f.ClientSet, f)
deployRBDPlugin()
@ -73,6 +75,12 @@ var _ = Describe("RBD", func() {
})
AfterEach(func() {
if CurrentGinkgoTestDescription().Failed {
// log provisoner
logsCSIPods("app=csi-rbdplugin-provisioner", c)
// log node plugin
logsCSIPods("app=csi-rbdplugin", c)
}
deleteRBDPlugin()
deleteConfigMap(rbdDirPath)
deleteResource(rbdExamplePath + "secret.yaml")