fabric8-services / fabric8-auth

Identity and Access Management for fabric8 services
https://auth.openshift.io/api/status
Apache License 2.0
14 stars 26 forks source link

improve stability of worker tests #840

Closed xcoulon closed 5 years ago

xcoulon commented 5 years ago

make sure that all workers are stopped before checking the database. Worker stop is async, so we need to check each worker state to make sure it was actually stopped.

Fixes #ODC727

Signed-off-by: Xavier Coulon xcoulon@redhat.com

xcoulon commented 5 years ago

LGTM. But don't we have the same issue with other worker tests? https://github.com/fabric8-services/fabric8-auth/tree/master/authentication/account/worker

Good point, indeed. I'll check the other tests

codecov[bot] commented 5 years ago

Codecov Report

Merging #840 into master will increase coverage by 0.02%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #840      +/-   ##
==========================================
+ Coverage   78.06%   78.08%   +0.02%     
==========================================
  Files          99       99              
  Lines        9318     9327       +9     
==========================================
+ Hits         7274     7283       +9     
  Misses       1505     1505              
  Partials      539      539
Impacted Files Coverage Δ
...ication/account/worker/user_deactivation_worker.go 46.34% <100%> (ø) :arrow_up:
worker/worker.go 64.83% <100%> (+3.85%) :arrow_up:
...nt/worker/user_deactivation_notification_worker.go 82.6% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2ccc4c6...1ee9935. Read the comment docs.

xcoulon commented 5 years ago

@alexeykazakov I've converted the worker tests to "benchmark tests" so we can run multiple iterations and make sure that it's always OK. The Jenkins logs show the following output:

...
pkg: github.com/fabric8-services/fabric8-auth/worker
BenchmarkWorker/BenchmarkMultipleWorkers            stopping 3 workers...
stopping 3 workers...
stopping 3 workers...
stopping 3 workers...
stopping 3 workers...
      20      60275154 ns/op       22428 B/op        396 allocs/op
BenchmarkWorker/BenchmarkMultipleWorkers-2          stopping 3 workers...
stopping 3 workers...
       2     553033246 ns/op      252272 B/op       4369 allocs/op
BenchmarkWorker/BenchmarkMultipleWorkers-4          stopping 3 workers...
stopping 3 workers...
       2     728599718 ns/op      365292 B/op       6129 allocs/op
PASS
ok      github.com/fabric8-services/fabric8-auth/worker 9.426s
...