mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-20 23:11:40 -04:00
backport of commit 4d6d3cc81e
This commit is contained in:
@@ -132,3 +132,20 @@ func (_ PanicCheck) Check(stdout, stderr string, _ error) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CustomCheck is meant to be a one-off checker with a user-provided function.
|
||||
//
|
||||
// Use this if none of the existing checkers match your use case, and it is not
|
||||
// reusable/generic enough for use in other tests.
|
||||
type CustomCheck struct {
|
||||
name string
|
||||
checkFunc func(stdout, stderr string, err error) error
|
||||
}
|
||||
|
||||
func (c CustomCheck) Check(stdout, stderr string, err error) error {
|
||||
return c.checkFunc(stdout, stderr, err)
|
||||
}
|
||||
|
||||
func (c CustomCheck) Name() string {
|
||||
return fmt.Sprintf("custom check - %s", c.name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user