GODT-1817: Add tests skips reporter checks to feature tests
Some tests on failure will produce sentry reports. Add a way to skip the check to see if any reports are produce when we know they will be triggered.
This commit is contained in:
@ -120,6 +120,9 @@ func TestFeatures(testingT *testing.T) {
|
|||||||
ctx.Step(`^the address "([^"]*)" of account "([^"]*)" has (\d+) messages in "([^"]*)"$`, s.theAddressOfAccountHasMessagesInMailbox)
|
ctx.Step(`^the address "([^"]*)" of account "([^"]*)" has (\d+) messages in "([^"]*)"$`, s.theAddressOfAccountHasMessagesInMailbox)
|
||||||
ctx.Step(`^the following fields were changed in draft (\d+) for address "([^"]*)" of account "([^"]*)":$`, s.theFollowingFieldsWereChangedInDraftForAddressOfAccount)
|
ctx.Step(`^the following fields were changed in draft (\d+) for address "([^"]*)" of account "([^"]*)":$`, s.theFollowingFieldsWereChangedInDraftForAddressOfAccount)
|
||||||
|
|
||||||
|
// === REPORTER ===
|
||||||
|
ctx.Step(`^test skips reporter checks$`, s.skipReporterChecks)
|
||||||
|
|
||||||
// ==== BRIDGE ====
|
// ==== BRIDGE ====
|
||||||
ctx.Step(`^bridge starts$`, s.bridgeStarts)
|
ctx.Step(`^bridge starts$`, s.bridgeStarts)
|
||||||
ctx.Step(`^bridge restarts$`, s.bridgeRestarts)
|
ctx.Step(`^bridge restarts$`, s.bridgeRestarts)
|
||||||
|
|||||||
@ -38,8 +38,9 @@ type reportRecorder struct {
|
|||||||
assert *assert.Assertions
|
assert *assert.Assertions
|
||||||
reports []reportRecord
|
reports []reportRecord
|
||||||
|
|
||||||
lock sync.Locker
|
lock sync.Locker
|
||||||
isClosed bool
|
isClosed bool
|
||||||
|
skipAssert bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newReportRecorder(tb testing.TB) *reportRecorder {
|
func newReportRecorder(tb testing.TB) *reportRecorder {
|
||||||
@ -51,6 +52,10 @@ func newReportRecorder(tb testing.TB) *reportRecorder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *reportRecorder) skipAsserts() {
|
||||||
|
r.skipAssert = true
|
||||||
|
}
|
||||||
|
|
||||||
func (r *reportRecorder) add(isException bool, message string, context reporter.Context) {
|
func (r *reportRecorder) add(isException bool, message string, context reporter.Context) {
|
||||||
r.lock.Lock()
|
r.lock.Lock()
|
||||||
defer r.lock.Unlock()
|
defer r.lock.Unlock()
|
||||||
@ -84,7 +89,9 @@ func (r *reportRecorder) close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *reportRecorder) assertEmpty() {
|
func (r *reportRecorder) assertEmpty() {
|
||||||
r.assert.Empty(r.reports)
|
if !r.skipAssert {
|
||||||
|
r.assert.Empty(r.reports)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *reportRecorder) removeMatchingRecords(isException, message, context gomock.Matcher, n int) {
|
func (r *reportRecorder) removeMatchingRecords(isException, message, context gomock.Matcher, n int) {
|
||||||
@ -147,3 +154,8 @@ func (r *reportRecorder) ReportExceptionWithContext(data any, context reporter.C
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *scenario) skipReporterChecks() error {
|
||||||
|
s.t.reporter.skipAsserts()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user