give up on refactoring TestFileUpload
The reason that t.Parallel broke the tests was because the parent test must finish before the parallel subtests can start. So, we'd be closing the httptest server and removing the tmpfile before any of the parallel subtests even began. We could refactor this to make the subtests parallel, but they're only two, and the parent is already parallel, so it's not worth the effort. See the added comment.
This commit is contained in:
parent
41e913e571
commit
7c8529b914
|
@ -984,12 +984,13 @@ func TestFileUpload(t *testing.T) {
|
|||
{SetUploadFiles(`input[name="upload"]`, []string{tmpfile.Name()}, NodeVisible)},
|
||||
}
|
||||
|
||||
// Don't run these tests in parallel. The only way to do so would be to
|
||||
// fire a separate httptest server and tmpfile for each. There's no way
|
||||
// to share these resources easily among parallel subtests, as the
|
||||
// parent must finish for the children to run, made impossible by the
|
||||
// defers above.
|
||||
for i, test := range tests {
|
||||
t.Run(fmt.Sprintf("test %d", i), func(t *testing.T) {
|
||||
// TODO: refactor the test so the subtests can run in
|
||||
// parallel
|
||||
//t.Parallel()
|
||||
|
||||
ctx, cancel := testAllocate(t, "")
|
||||
defer cancel()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user