@@ -99,6 +99,8 @@ type Helm interface {
99
99
//
100
100
// GetPods gets pods for the given args
101
101
//
102
+ // GetEvents prints all events for namespace
103
+ //
102
104
// DescribePod prints the pod's description
103
105
//
104
106
// Logs prints the logs of container
@@ -111,6 +113,7 @@ type Kubectl interface {
111
113
WaitForDeployments (namespace string , selector string ) error
112
114
GetPodsforDeployment (namespace string , deployment string ) ([]string , error )
113
115
GetPods (args ... string ) ([]string , error )
116
+ GetEvents (namespace string ) error
114
117
DescribePod (namespace string , pod string ) error
115
118
Logs (namespace string , pod string , container string ) error
116
119
GetInitContainers (namespace string , pod string ) ([]string , error )
@@ -608,13 +611,13 @@ func (t *Testing) generateInstallConfig(chart *Chart) (namespace, release, relea
608
611
release , _ = chart .CreateInstallParams (t .config .BuildId )
609
612
releaseSelector = fmt .Sprintf ("%s=%s" , t .config .ReleaseLabel , release )
610
613
cleanup = func () {
611
- t .PrintPodDetailsAndLogs (namespace , releaseSelector )
614
+ t .PrintEventsPodDetailsAndLogs (namespace , releaseSelector )
612
615
t .helm .DeleteRelease (release )
613
616
}
614
617
} else {
615
618
release , namespace = chart .CreateInstallParams (t .config .BuildId )
616
619
cleanup = func () {
617
- t .PrintPodDetailsAndLogs (namespace , releaseSelector )
620
+ t .PrintEventsPodDetailsAndLogs (namespace , releaseSelector )
618
621
t .helm .DeleteRelease (release )
619
622
t .kubectl .DeleteNamespace (namespace )
620
623
}
@@ -812,7 +815,13 @@ func (t *Testing) ValidateMaintainers(chart *Chart) error {
812
815
return nil
813
816
}
814
817
815
- func (t * Testing ) PrintPodDetailsAndLogs (namespace string , selector string ) {
818
+ func (t * Testing ) PrintEventsPodDetailsAndLogs (namespace string , selector string ) {
819
+ util .PrintDelimiterLine ("=" )
820
+
821
+ printDetails (namespace , "Events of namespace" , "." , func (item string ) error {
822
+ return t .kubectl .GetEvents (namespace )
823
+ }, namespace )
824
+
816
825
pods , err := t .kubectl .GetPods (
817
826
"--no-headers" ,
818
827
"--namespace" ,
@@ -827,8 +836,6 @@ func (t *Testing) PrintPodDetailsAndLogs(namespace string, selector string) {
827
836
return
828
837
}
829
838
830
- util .PrintDelimiterLine ("=" )
831
-
832
839
for _ , pod := range pods {
833
840
printDetails (pod , "Description of pod" , "~" , func (item string ) error {
834
841
return t .kubectl .DescribePod (namespace , pod )
@@ -861,12 +868,12 @@ func (t *Testing) PrintPodDetailsAndLogs(namespace string, selector string) {
861
868
util .PrintDelimiterLine ("=" )
862
869
}
863
870
864
- func printDetails (pod string , text string , delimiterChar string , printFunc func (item string ) error , items ... string ) {
871
+ func printDetails (resource string , text string , delimiterChar string , printFunc func (item string ) error , items ... string ) {
865
872
for _ , item := range items {
866
873
item = strings .Trim (item , "'" )
867
874
868
875
util .PrintDelimiterLine (delimiterChar )
869
- fmt .Printf ("==> %s %s\n " , text , pod )
876
+ fmt .Printf ("==> %s %s\n " , text , resource )
870
877
util .PrintDelimiterLine (delimiterChar )
871
878
872
879
if err := printFunc (item ); err != nil {
@@ -875,7 +882,7 @@ func printDetails(pod string, text string, delimiterChar string, printFunc func(
875
882
}
876
883
877
884
util .PrintDelimiterLine (delimiterChar )
878
- fmt .Printf ("<== %s %s\n " , text , pod )
885
+ fmt .Printf ("<== %s %s\n " , text , resource )
879
886
util .PrintDelimiterLine (delimiterChar )
880
887
}
881
888
}
0 commit comments