@@ -106,21 +106,7 @@ func (m *EmbeddedCluster) E2eRunHeadless(
106106 // Collect support bundle before cleanup
107107 if vm != nil && ! skipSupportBundleCollection {
108108 fmt .Printf ("Collecting support bundle from VM %s...\n " , vm .VmID )
109- supportBundle , bundleErr := vm .CollectClusterSupportBundle (ctx )
110- if bundleErr != nil {
111- fmt .Printf ("Warning: failed to collect support bundle: %v\n " , bundleErr )
112- resultsDir = resultsDir .WithNewFile ("support-bundle-error.txt" , fmt .Sprintf ("Failed to collect support bundle: %v" , bundleErr ))
113- } else {
114- resultsDir = resultsDir .WithFile ("support-bundle.tar.gz" , supportBundle )
115- }
116-
117- hostSupportBundle , hostBundleErr := vm .CollectHostSupportBundle (ctx )
118- if hostBundleErr != nil {
119- fmt .Printf ("Warning: failed to collect host support bundle: %v\n " , hostBundleErr )
120- resultsDir = resultsDir .WithNewFile ("host-support-bundle-error.txt" , fmt .Sprintf ("Failed to collect host support bundle: %v" , hostBundleErr ))
121- } else {
122- resultsDir = resultsDir .WithFile ("host-support-bundle.tar.gz" , hostSupportBundle )
123- }
109+ resultsDir = collectSupportBundles (ctx , vm , resultsDir )
124110 }
125111
126112 // Marshal final test result to JSON
@@ -187,17 +173,92 @@ func (m *EmbeddedCluster) E2eRunHeadless(
187173 // Update final test result
188174 testResult .Success = validationResult .Success
189175 testResult .ValidationResults = validationResult
190-
191176 if ! validationResult .Success {
192177 testResult .Error = "validation checks failed"
193- fmt .Printf ("Test FAILED: %s %s test validation failed\n " , scenario , mode )
194- } else {
195- fmt .Printf ("Test PASSED: %s %s test completed successfully\n " , scenario , mode )
196178 }
197179
180+ // Print formatted test results
181+ printResults (validationResult , scenario , mode , appVersion , kubeVersion , vm )
182+
198183 return
199184}
200185
186+ func collectSupportBundles (ctx context.Context , vm * CmxInstance , resultsDir * dagger.Directory ) * dagger.Directory {
187+ fmt .Printf ("Collecting support bundle from VM %s...\n " , vm .VmID )
188+ supportBundle , bundleErr := vm .CollectClusterSupportBundle (ctx )
189+ if bundleErr != nil {
190+ fmt .Printf ("Warning: failed to collect support bundle: %v\n " , bundleErr )
191+ resultsDir = resultsDir .WithNewFile ("support-bundle-error.txt" , fmt .Sprintf ("Failed to collect support bundle: %v" , bundleErr ))
192+ } else {
193+ resultsDir = resultsDir .WithFile ("support-bundle.tar.gz" , supportBundle )
194+ }
195+
196+ hostSupportBundle , hostBundleErr := vm .CollectHostSupportBundle (ctx )
197+ if hostBundleErr != nil {
198+ fmt .Printf ("Warning: failed to collect host support bundle: %v\n " , hostBundleErr )
199+ resultsDir = resultsDir .WithNewFile ("host-support-bundle-error.txt" , fmt .Sprintf ("Failed to collect host support bundle: %v" , hostBundleErr ))
200+ } else {
201+ resultsDir = resultsDir .WithFile ("host-support-bundle.tar.gz" , hostSupportBundle )
202+ }
203+
204+ return resultsDir
205+ }
206+
207+ func printResults (validationResult * ValidationResult , scenario string , mode string , appVersion string , kubeVersion string , vm * CmxInstance ) {
208+ fmt .Printf ("\n " )
209+ fmt .Printf ("================================\n " )
210+ if validationResult .Success {
211+ fmt .Printf ("✓ E2E TEST PASSED\n " )
212+ } else {
213+ fmt .Printf ("✗ E2E TEST FAILED\n " )
214+ }
215+ fmt .Printf ("================================\n " )
216+ fmt .Printf ("Scenario: %s\n " , scenario )
217+ fmt .Printf ("Mode: %s\n " , mode )
218+ fmt .Printf ("App Version: %s\n " , appVersion )
219+ fmt .Printf ("Kube Version: %s\n " , kubeVersion )
220+ fmt .Printf ("VM ID: %s\n " , vm .VmID )
221+ fmt .Printf ("\n " )
222+ fmt .Printf ("Validation Results:\n " )
223+ fmt .Printf (" Cluster Health: %s\n " , formatCheckResult (validationResult .ClusterHealth ))
224+ fmt .Printf (" Installation CRD: %s\n " , formatCheckResult (validationResult .InstallationCRD ))
225+ fmt .Printf (" App Deployment: %s\n " , formatCheckResult (validationResult .AppDeployment ))
226+ fmt .Printf (" Admin Console: %s\n " , formatCheckResult (validationResult .AdminConsole ))
227+ fmt .Printf (" Data Directories: %s\n " , formatCheckResult (validationResult .DataDirectories ))
228+ fmt .Printf (" Pods and Jobs: %s\n " , formatCheckResult (validationResult .PodsAndJobs ))
229+
230+ if ! validationResult .Success {
231+ fmt .Printf ("\n " )
232+ fmt .Printf ("Failed Checks:\n " )
233+ if ! validationResult .ClusterHealth .Passed {
234+ fmt .Printf (" • Cluster Health: %s\n " , validationResult .ClusterHealth .ErrorMessage )
235+ }
236+ if ! validationResult .InstallationCRD .Passed {
237+ fmt .Printf (" • Installation CRD: %s\n " , validationResult .InstallationCRD .ErrorMessage )
238+ }
239+ if ! validationResult .AppDeployment .Passed {
240+ fmt .Printf (" • App Deployment: %s\n " , validationResult .AppDeployment .ErrorMessage )
241+ }
242+ if ! validationResult .AdminConsole .Passed {
243+ fmt .Printf (" • Admin Console: %s\n " , validationResult .AdminConsole .ErrorMessage )
244+ }
245+ if ! validationResult .DataDirectories .Passed {
246+ fmt .Printf (" • Data Directories: %s\n " , validationResult .DataDirectories .ErrorMessage )
247+ }
248+ if ! validationResult .PodsAndJobs .Passed {
249+ fmt .Printf (" • Pods and Jobs: %s\n " , validationResult .PodsAndJobs .ErrorMessage )
250+ }
251+ }
252+ fmt .Printf ("================================\n \n " )
253+ }
254+
255+ func formatCheckResult (check * CheckResult ) string {
256+ if check .Passed {
257+ return "✓ PASSED"
258+ }
259+ return "✗ FAILED"
260+ }
261+
201262func parseLicense (ctx context.Context , licenseFile * dagger.File ) (contents string , licenseID string , channelID string , err error ) {
202263 contents , err = licenseFile .Contents (ctx )
203264 if err != nil {
0 commit comments