state: use runCase pattern for large test
The TestServiceHealthEventsFromChanges function was over 1400 lines. Attempting to debug test failures in test functions this large is difficult. It requires scrolling to the line which defines the testcase because the failure message only includes the line number of the assertion, not the line number of the test case. This is an excellent example of where test tables stop working well, and start being a problem. To mitigate this problem, the runCase pattern can be used. When one of these tests fails, a failure message will print the line number of both the test case and the assertion. This allows a developer to quickly jump to both of the relevant lines, signficanting reducing the time it takes to debug test failures. For example, one such failure could look like this: catalog_events_test.go:1610: case: service reg, new node catalog_events_test.go:1605: assertion failed: values are not equal
This commit is contained in:
parent
bfcd311159
commit
0b5dfee00a
|
@ -1,7 +0,0 @@
|
|||
// +build !consulent
|
||||
|
||||
package state
|
||||
|
||||
func withServiceHealthEnterpriseCases(cases []serviceHealthTestCase) []serviceHealthTestCase {
|
||||
return cases
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue