update to deregister_workers lua script is.

Refactor test according to suggestions from @myronmarston