BUG-8858: rework singleton group locking
Group locking relied on a single semaphore held for long periods
of time, with undeterministic locking in face of timing variance.
This patch reworks the logic to properly lock and manage object
lifecycle. It also expands the test suite to cover cleanup scenarios,
while removing test duplication.
The test suite is expanded slightly to assert that asynchronous
service group cleanup does not interfere with user's ability to
reuse the same group.
Change-Id: I68eb6d0b59b2ab0e1cf98dc374e029fad3d19734
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
cb1f6ccf2ae60b8405a42e583f190858924b2d41)