18076: Fixes the bug, expands the test with additional checks.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 2 Sep 2021 18:54:23 +0000 (15:54 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 2 Sep 2021 19:03:08 +0000 (16:03 -0300)
commit7aa1380f8dbca657b347df513baca513c10650ba
tree17f67d7df71e529fc3e744df73c6c316f43d8499
parent43e6f6ecae2eb26b58cfc0afb44b2b6476408741
18076: Fixes the bug, expands the test with additional checks.

If there's a stale cached user record that's creating the username collision,
set it to nil before retrying the update. There're two scenarios this is
covering:

1. The stale user record belongs to an existing user on LoginCluster. Its
   username was taken by other user so the new username is coming in the
   batch_update operation -- it's ok to temporarily have it set to nil.
2. The stale user record doesn't exist on LoginCluster anymore, so having
   it being reset to nil isn't harmful and avoids future collisions.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>
lib/controller/integration_test.go
services/api/app/controllers/arvados/v1/users_controller.rb