()
| 1021 | } |
| 1022 | |
| 1023 | func (s *SchemaDiffPrinter) Render() error { |
| 1024 | if len(s.errors) == 0 { |
| 1025 | return nil |
| 1026 | } |
| 1027 | |
| 1028 | var opts []tablewriter.Option |
| 1029 | opts = append(opts, tablewriter.WithHeaderAutoWrap(tw.WrapNone)) |
| 1030 | opts = append(opts, tablewriter.WithHeaderAlignment(tw.AlignLeft)) |
| 1031 | opts = append(opts, tablewriter.WithRowAutoWrap(tw.WrapNone)) |
| 1032 | opts = append(opts, tablewriter.WithTrimSpace(tw.Off)) |
| 1033 | if !models.IsAnsiDisabled { |
| 1034 | opts = append(opts, tablewriter.WithRenderer(newDiffTableRenderer())) |
| 1035 | } |
| 1036 | opts = append(opts, tablewriter.WithRowAlignment(tw.AlignLeft)) |
| 1037 | table := tablewriter.NewTable(s.out, opts...) |
| 1038 | table.Header([]string{"Schema Check Failed", "Expected", "Actual"}) |
| 1039 | |
| 1040 | for _, e := range s.errors { |
| 1041 | exp := e.Expected |
| 1042 | act := e.Actual |
| 1043 | reason := e.Reason |
| 1044 | |
| 1045 | table.Append([]string{reason, exp, act}) |
| 1046 | } |
| 1047 | |
| 1048 | fmt.Fprintf(s.out, "\nTestrun failed for testcase with id: %s\n", s.testCase) |
| 1049 | table.Render() |
| 1050 | fmt.Fprintln(s.out) // Add a newline after |
| 1051 | return nil |
| 1052 | } |
| 1053 | |
| 1054 | // stripANSI removes ANSI escape sequences for accurate emptiness checks. |
| 1055 | func stripANSI(s string) string { |
no test coverage detected