-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antithesis] Enable reuse of banff e2e test for antithesis testing
- Loading branch information
Showing
10 changed files
with
408 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package antithesis | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"maps" | ||
|
||
"github.com/antithesishq/antithesis-sdk-go/assert" | ||
|
||
"github.com/ava-labs/avalanchego/tests" | ||
) | ||
|
||
// NewInstrumentedTestContext returns a test context that makes antithesis SDK assertions. | ||
func NewInstrumentedTestContext() *tests.SimpleTestContext { | ||
return NewInstrumentedTestContextWithArgs(nil, "", nil) | ||
} | ||
|
||
// NewInstrumentedTestContextWithArgs returns a test context that makes antithesis SDK assertions. | ||
func NewInstrumentedTestContextWithArgs( | ||
ctx context.Context, | ||
prefix string, | ||
details map[string]any, | ||
) *tests.SimpleTestContext { | ||
return tests.NewTestContextWithArgs( | ||
ctx, | ||
prefix, | ||
func(format string, args ...any) { | ||
assert.Unreachable(fmt.Sprintf("Assertion failure: "+format, args...), details) | ||
}, | ||
func(r any) { | ||
detailsClone := maps.Clone(details) | ||
details["panic"] = r | ||
assert.Unreachable("unexpected panic", detailsClone) | ||
}, | ||
) | ||
} |
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.