mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-02 11:30:13 -05:00
/go/cmd/dolt/commands/ci/run.go: format repo
This commit is contained in:
@@ -190,32 +190,32 @@ func formatSavedQueryDetails(savedQueryName, query string, err error) string {
|
||||
if err != nil {
|
||||
status = "FAIL"
|
||||
}
|
||||
var statusColored string
|
||||
switch status {
|
||||
case "PASS":
|
||||
statusColored = color.GreenString(status)
|
||||
case "FAIL":
|
||||
statusColored = color.RedString(status)
|
||||
default:
|
||||
// Leave unknown statuses uncolored; easy to extend later
|
||||
statusColored = status
|
||||
}
|
||||
var statusColored string
|
||||
switch status {
|
||||
case "PASS":
|
||||
statusColored = color.GreenString(status)
|
||||
case "FAIL":
|
||||
statusColored = color.RedString(status)
|
||||
default:
|
||||
// Leave unknown statuses uncolored; easy to extend later
|
||||
statusColored = status
|
||||
}
|
||||
|
||||
lines := []string{fmt.Sprintf(" - %s - %s", savedQueryName, statusColored)}
|
||||
|
||||
// Only include query and error details on failure
|
||||
// Only include query and error details on failure
|
||||
if err != nil {
|
||||
if strings.TrimSpace(query) != "" {
|
||||
lines = append(lines, fmt.Sprintf(" - query: %s", query))
|
||||
}
|
||||
// Summarize error lines
|
||||
var parts []string
|
||||
for _, l := range strings.Split(err.Error(), "\n") {
|
||||
trimmed := strings.TrimSpace(l)
|
||||
if trimmed != "" {
|
||||
parts = append(parts, trimmed)
|
||||
}
|
||||
}
|
||||
// Summarize error lines
|
||||
var parts []string
|
||||
for _, l := range strings.Split(err.Error(), "\n") {
|
||||
trimmed := strings.TrimSpace(l)
|
||||
if trimmed != "" {
|
||||
parts = append(parts, trimmed)
|
||||
}
|
||||
}
|
||||
if len(parts) > 0 {
|
||||
lines = append(lines, fmt.Sprintf(" - error: %s", color.RedString(strings.Join(parts, "; "))))
|
||||
}
|
||||
@@ -228,10 +228,10 @@ func runCIQuery(queryist cli.Queryist, sqlCtx *sql.Context, step *dolt_ci.SavedQ
|
||||
return nil, fmt.Errorf("Could not find saved query: %s", step.SavedQueryName.Value)
|
||||
}
|
||||
|
||||
rows, err := cli.GetRowsForSql(queryist, sqlCtx, query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Query error: %s", err.Error())
|
||||
}
|
||||
rows, err := cli.GetRowsForSql(queryist, sqlCtx, query)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Query error: %s", err.Error())
|
||||
}
|
||||
|
||||
return rows, nil
|
||||
}
|
||||
@@ -263,8 +263,8 @@ func assertQueries(rows []sql.Row, expectedRowsAndComparison string, expectedCol
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
return errors.New(strings.Join(errs, "\n"))
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
return errors.New(strings.Join(errs, "\n"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user