TIL while working on <https://github.com/treeverse...
# dev
a
TIL while working on https://github.com/treeverse/lakeFS/issues/1319 that gomock has trouble testing goroutines. Specifically https://github.com/golang/mock/issues/346 is open (tl;dr: mock calls
t.Fatal
on an unexpected failure because it has nothing better to do, and
t.Fatal
is broken and doesn't work in goroutines. This is a good argument for not using gomock at all in new code -- it is extremely dependent on the implementation. For now I may rewrite batch_test.go to use fakes. Any better ideas?
b
Can you run the specific test and give the NewController your implementation that calls t.Errorf?
Copy code
type TestReporter interface {
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}
a
I don't think that is the correct interface for
Fatalf
in a language that doesn't support exceptions: there is no way to specify what the method should return when a call has no matches. If I did specify an
Any()(, Any(), Any(), ...
matcher then it could return an error -- but then mock cannot test that the correct calls occurred, and (more importantly) it doesn't call
Fatalf
so the problem goes away...
1
b
Can check testify mock