Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: Allow Concurrently Executing Tests #7

Open
eduncan911 opened this issue Jun 23, 2016 · 0 comments
Open

Refactoring: Allow Concurrently Executing Tests #7

eduncan911 opened this issue Jun 23, 2016 · 0 comments
Assignees

Comments

@eduncan911
Copy link
Owner

eduncan911 commented Jun 23, 2016

Since Go 1.5, GOMAXPROCS is now set to the number of cores on the machine. When you run go test, Go actually compiles a temp binary that runs each func Test(t *testing.T) in a goroutine. But note that default behavior for Go tests is synchronously - that is, it still runs 1 test at a time.

You've always had the ability to call t.Parallel() before 1.5; but, this was of little use without setting GOMAXPROCS properly. Well now that GOMAXPROCS is set to the number of virtual cores by default, this means t.Parallel() in tests will now make the tests run concurrently.

But using this package you defeat the advantage of running 100s of unit tests concurrently and instead is forced to run each Test harness for a group of Specs - those Specs will run synchronously and thus be slower overall.

The refactoring should make heavy use of goroutines where appropriate, without slowing down simple tests. By moving to use goroutines for most inner loops, we should get the added benefit of increasing performance overall - even without the t.Parallel() flag being set!

See #4 for details.

@eduncan911 eduncan911 changed the title Allow Concurrently Executing Tests Refactoring: Allow Concurrently Executing Tests Jun 23, 2016
@eduncan911 eduncan911 self-assigned this Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant