@@ -55,11 +55,34 @@ var _ = Describe("Operator", Ordered, func() {
5555 "--path" , tempDir ,
5656 "--registry" , registry ,
5757 "--registry-insecure" , strconv .FormatBool (registryInsecure ))
58- _ , err = utils .Run (cmd )
58+ out , err : = utils .Run (cmd )
5959 Expect (err ).NotTo (HaveOccurred ())
60+ _ , _ = fmt .Fprint (GinkgoWriter , out )
6061 })
6162
6263 AfterEach (func () {
64+ specReport := CurrentSpecReport ()
65+ if specReport .Failed () {
66+ if functionName != "" {
67+ cmd := exec .Command ("kubectl" , "get" , "function" , functionName , "-n" , functionNamespace , "-o" , "yaml" )
68+ function , err := utils .Run (cmd )
69+ if err == nil {
70+ _ , _ = fmt .Fprintf (GinkgoWriter , "Function:\n %s" , function )
71+ } else {
72+ _ , _ = fmt .Fprintf (GinkgoWriter , "Failed to get function: %s" , err )
73+ }
74+ }
75+
76+ By ("Fetching controller manager pod logs" )
77+ cmd := exec .Command ("kubectl" , "logs" , "-l" , "control-plane=controller-manager" , "-n" , namespace )
78+ controllerLogs , err := utils .Run (cmd )
79+ if err == nil {
80+ _ , _ = fmt .Fprintf (GinkgoWriter , "Controller logs:\n %s" , controllerLogs )
81+ } else {
82+ _ , _ = fmt .Fprintf (GinkgoWriter , "Failed to get Controller logs: %s" , err )
83+ }
84+ }
85+
6386 if tempDir != "" {
6487 cmd := exec .Command ("func" , "delete" , "--path" , tempDir )
6588 _ , err := utils .Run (cmd )
0 commit comments