-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QT-708] various fixes for larger repositories (#133)
This adds a few small quality of life fixes into the enos cli that become more apparent when working in larger repositories, longer running scenarios, or syntax issues in scenarios with many variants. * `enos scenario list` now returns a stream of scenarios rather than a single response. Not only does this make listing directories with several hundred thousand scenarios possible without changing the gRPC message size limits, it actually improves the speed. Since our client and server implementation are bundled together, changing this API is fine. * Allow passing in `-gcflags` when compiling enos with `make`. This makes it easier to build binaries without optimizations for debugging. * Increase our default CLI timeout to 1 hour. * Short circuit validation when we encounter an error diagnostic. This makes it so find issues quickly rather than attempting to validate everything. * Fix a panic in scneario outlines when a scenario has no matrices. * Update Go modules. * Bump version Signed-off-by: Ryan Cragun <[email protected]>
- Loading branch information
1 parent
98c23bb
commit 750db2b
Showing
20 changed files
with
1,423 additions
and
1,133 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
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
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,54 @@ | ||
package diagnostics | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/hashicorp/enos/proto/hashicorp/enos/v1/pb" | ||
) | ||
|
||
var _ error = (*Error)(nil) | ||
|
||
func NewError() *Error { | ||
return &Error{} | ||
} | ||
|
||
// Error is an error that can carry diagnostics information. | ||
type Error struct { | ||
Diags []*pb.Diagnostic | ||
DiagStringOpts []StringOpt | ||
Err error | ||
} | ||
|
||
// Error returns a joined message from all diagnostics errors. | ||
func (e *Error) Error() string { | ||
if e.Diags == nil { | ||
if e.Err != nil { | ||
return e.Err.Error() | ||
} | ||
|
||
return "" | ||
} | ||
|
||
msg := strings.Builder{} | ||
|
||
if e.Err != nil { | ||
msg.WriteString(e.Err.Error()) | ||
} | ||
|
||
for _, diag := range e.Diags { | ||
_, _ = msg.WriteString(String(diag, e.DiagStringOpts...)) | ||
} | ||
|
||
return msg.String() | ||
} | ||
|
||
// Unwrap returns the wrapped error. | ||
func (e *Error) Unwrap() error { | ||
return e.Err | ||
} | ||
|
||
// SetStringOpts allows configuring the stringer opts on the error. This allows the caller | ||
// to determine the formatting of the error message if diagnostics are preset. | ||
func (e *Error) SetStringOpts(opts ...StringOpt) { | ||
e.DiagStringOpts = opts | ||
} |
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
Oops, something went wrong.