Skip to content

Commit e9fa30f

Browse files
committed
only log extra info on failure
1 parent 1539252 commit e9fa30f

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tests/chart_platform_integration_test.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,21 @@ func (suite *PlatformChartIntegrationSuite) TestBasicDeployment() {
8484
helm.Install(suite.T(), options, suite.chartPath, releaseName)
8585

8686
defer func() {
87-
secret := k8s.GetSecret(suite.T(), kubectlOptions, "platform-tls")
88-
secretJson, _ := json.MarshalIndent(secret, "", " ")
89-
fmt.Println("TLS Secret: ", string(secretJson))
90-
pods := k8s.ListPods(suite.T(), kubectlOptions, metav1.ListOptions{})
91-
for _, pod := range pods {
92-
if strings.Contains(pod.Name, "opentdf-platform") {
93-
fmt.Println("Pod Name: ", pod.Name)
94-
fmt.Println("Pod Status: ", pod.Status.Phase)
95-
fmt.Println("Pod Reason: ", pod.Status.Reason)
96-
podJson, _ := json.MarshalIndent(pod, "", " ")
97-
fmt.Println("Pod: ", string(podJson))
98-
platLogs := k8s.GetPodLogs(suite.T(), kubectlOptions, &pod, "platform")
99-
fmt.Println("Platform Logs: ", platLogs)
87+
if suite.T().Failed() {
88+
secret := k8s.GetSecret(suite.T(), kubectlOptions, "platform-tls")
89+
secretJson, _ := json.MarshalIndent(secret, "", " ")
90+
fmt.Println("TLS Secret: ", string(secretJson))
91+
pods := k8s.ListPods(suite.T(), kubectlOptions, metav1.ListOptions{})
92+
for _, pod := range pods {
93+
if strings.Contains(pod.Name, "opentdf-platform") {
94+
fmt.Println("Pod Name: ", pod.Name)
95+
fmt.Println("Pod Status: ", pod.Status.Phase)
96+
fmt.Println("Pod Reason: ", pod.Status.Reason)
97+
podJson, _ := json.MarshalIndent(pod, "", " ")
98+
fmt.Println("Pod: ", string(podJson))
99+
platLogs := k8s.GetPodLogs(suite.T(), kubectlOptions, &pod, "platform")
100+
fmt.Println("Platform Logs: ", platLogs)
101+
}
100102
}
101103
}
102104
helm.Delete(suite.T(), options, releaseName, true)

0 commit comments

Comments
 (0)