tests/thirdparty: add skip option (#228)

Add the ability to skip third-party tests by specifying a known issue.
This commit is contained in:
Michael McLoughlin
2021-11-10 18:44:28 -08:00
committed by GitHub
parent 6c0ed1c4e8
commit 2867bd7e01
7 changed files with 157 additions and 0 deletions

View File

@@ -93,6 +93,11 @@ type Package struct {
// Test steps. If empty, defaults to "go test ./...".
Test []*Step `json:"test,omitempty"`
// If the package test has a known problem, record it by setting this to a
// non-zero avo issue number. If set, the package will be skipped in
// testing.
KnownIssue int `json:"known_issue,omitempty"`
}
// ID returns an identifier for the package.
@@ -101,6 +106,17 @@ func (p *Package) ID() string {
return strings.ReplaceAll(pkgpath, "/", "-")
}
// Skip reports whether the package test should be skipped. If skipped, a known
// issue will be set.
func (p *Package) Skip() bool {
return p.KnownIssue != 0
}
// Reason returns the reason why the test is skipped.
func (p *Package) Reason() string {
return fmt.Sprintf("https://github.com/mmcloughlin/avo/issues/%d", p.KnownIssue)
}
// defaults sets or removes default field values.
func (p *Package) defaults(set bool) {
for _, stage := range []struct {