1616package scaffold
1717
1818import (
19- "bytes"
2019 "context"
2120 "crypto/tls"
2221 "crypto/x509"
2322 "fmt"
24- "io"
2523 "net"
2624 "net/http"
2725 "net/url"
@@ -36,7 +34,6 @@ import (
3634 "github.com/gruntwork-io/terratest/modules/testing"
3735 . "github.com/onsi/ginkgo/v2"
3836 . "github.com/onsi/gomega"
39- "github.com/stretchr/testify/require"
4037 corev1 "k8s.io/api/core/v1"
4138 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4239 "k8s.io/apimachinery/pkg/util/wait"
@@ -453,31 +450,13 @@ func (s *Scaffold) DeployTestService() {
453450func (s * Scaffold ) afterEach () {
454451 defer GinkgoRecover ()
455452 s .DeleteGatewayGroup (s .gatewaygroupid )
456- _ , _ = fmt .Fprintf (GinkgoWriter , "s.namespace: %s\n " , s .namespace )
457- _ , _ = fmt .Fprintf (GinkgoWriter , "s.kubectlOptions: %+v\n " , s .kubectlOptions )
458453
459454 if CurrentSpecReport ().Failed () {
460455 if os .Getenv ("TSET_ENV" ) == "CI" {
461- var buf = bytes .NewBuffer (nil )
462456 _ , _ = fmt .Fprintln (GinkgoWriter , "Dumping namespace contents" )
463- output , _ := k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "get" , "deploy,sts,svc,pods" )
464- if output != "" {
465- _ , _ = fmt .Fprintln (io .MultiWriter (GinkgoWriter , buf ), output )
466- }
467- output , _ = k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "describe" , "pods" )
468- if output != "" {
469- _ , _ = buf .WriteString ("/n" )
470- _ , _ = fmt .Fprintln (io .MultiWriter (GinkgoWriter , buf ), output )
471- }
472- output , _ = k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "logs" , "-l" ,
473- "control-plane=controller-manager" )
474- if output != "" {
475- _ , _ = buf .WriteString ("/n" )
476- _ , _ = buf .WriteString ("controller-manager log\n " )
477- _ , _ = buf .WriteString (output )
478- _ , _ = buf .WriteString ("/n" )
479- require .NoError (GinkgoT (), os .WriteFile ("../../" + s .namespace + "-controller-manager.log" , buf .Bytes (), 0644 ))
480- }
457+ _ , _ = k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "get" , "deploy,sts,svc,pods" )
458+ _ , _ = k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "describe" , "pods" )
459+ _ , _ = k8s .RunKubectlAndGetOutputE (GinkgoT (), s .kubectlOptions , "logs" , "-l" , "control-plane=controller-manager" )
481460 }
482461 }
483462
0 commit comments