Closed ThomasKasene closed 3 years ago
The pull request looks pretty solid. I'd like to keep the implementations as-is meaning not extracting common bits into methods to keep things simple and more readable (and together). It would also make sense to extend the tests, specifically for SecretLeaseContainerUnitTests
since we're quite lenient in the tests right now.
Hmm, SecretLeaseContainerUnitTests
mocks out everything at the moment though. Should I change all that or just try to make a LeaseEndpointsUnitTests
instead?
I can put the code back to its original state, but does that also include the implementation for SysLeases
, or should that still use the implementation from Leases
to emphasize that it's the same thing?
By the way, I noticed the argument list for the old revocation implementation includes lease.getLeaseId()
but that shouldn't be necessary, should it? The lease ID will be passed into the PUT request body:
operations.exchange(endpoint, HttpMethod.PUT, LeaseEndpoints.getLeaseRevocationBody(lease), Map.class,
lease.getLeaseId());
I gambled and added LeaseEndpointsUnitTests
- it might be useful regardless of whatever should be done about SecretLeaseContainerUnitTests
, if anything.
While I looked around in SecretLeaseContainerUnitTests
I took the liberty of replacing the usages of Mockito.verifyZeroInteractions
with Mockito.verifyNoInteractions
because the former is deprecated. I still don't know how to improve this test class with regards to the changes made to LeaseEndpoints
, though.
I also reverted the refactoring in LeaseEndpoints
and assumed you wanted me to copy the contents from Leases
into SysLeases
rather than calling Leases.renew
and Leases.revoke
.
Thank you for your contribution. That's merged and polished now.
Changes made to
LeaseEndpoints
:LeasesRevokedByPrefix
which uses the/sys/leases/revoke-prefix/{prefix}
endpoint when revoking leasesLeases
which work just likeSysLeases
, ie. it uses the/sys/leases/revoke
endpoint when revoking leasesSysLeases
in favour ofLeases
Closes #588.