-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from bearium/stdout_results
Added Namespace for Collection and Allows for tests to output to stdout
- Loading branch information
Showing
8 changed files
with
131 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
analyzerunner "github.com/replicatedhq/troubleshoot/pkg/analyze" | ||
) | ||
|
||
func showStdoutResults(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error { | ||
fmt.Printf("\n=== TEST %s\n", preflightName) | ||
for _, analyzeResult := range analyzeResults { | ||
fmt.Printf("=== RUN: %s\n", analyzeResult.Title) | ||
} | ||
var failed bool | ||
for _, analyzeResult := range analyzeResults { | ||
testResultfailed := outputResult(analyzeResult) | ||
if testResultfailed { | ||
failed = true | ||
} | ||
} | ||
if failed { | ||
fmt.Printf("--- FAIL %s\n", preflightName) | ||
fmt.Println("FAILED") | ||
} else { | ||
fmt.Printf("--- PASS %s\n", preflightName) | ||
fmt.Println("PASS") | ||
} | ||
return nil | ||
} | ||
|
||
func outputResult(analyzeResult *analyzerunner.AnalyzeResult) bool { | ||
if analyzeResult.IsPass { | ||
fmt.Printf(" --- PASS %s\n", analyzeResult.Title) | ||
fmt.Printf(" --- %s\n", analyzeResult.Message) | ||
} else if analyzeResult.IsWarn { | ||
fmt.Printf(" --- WARN: %s\n", analyzeResult.Title) | ||
fmt.Printf(" --- %s\n", analyzeResult.Message) | ||
} else if analyzeResult.IsFail { | ||
fmt.Printf(" --- FAIL: %s\n", analyzeResult.Title) | ||
fmt.Printf(" --- %s\n", analyzeResult.Message) | ||
return true | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.