loong / go-concurrency-exercises

Hands on exercises with real-life examples to study and practice Go concurrency patterns. Test-cases are provided to verify your answers.
Other
1.17k stars 401 forks source link

How to measure the test duration in exercise 2? #39

Open rafiramadhana opened 8 months ago

rafiramadhana commented 8 months ago

As mentioned in /2-race-in-cache/README.md

If possible, get your solution down to less than 5 seconds for all tests.

And you also mention to run the test, we run the following command

Use the following command to test for race conditions and correct functionality:

go test -race

Does the "5 second for all tests." should happen when running go test or go test -race?

Because this is what happened in my local

➜  2-race-in-cache git:(main) ✗ go test -race
PASS
ok      github.com/loong/go-concurrency-exercises/2-race-in-cache       5.178s
➜  2-race-in-cache git:(main) ✗ go test      
PASS
ok      github.com/loong/go-concurrency-exercises/2-race-in-cache       4.122s

I'm quite confused if I have passed the 5 seconds threshold or nah

Thanks!