Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gce): Convert GoogleRegionalServerGroupCachingAgent to java (#…
…4007) * refactor(gce): remove an unnecessary checkState() We can survive this condition just fine. * test(gce): Add a test about on-demand caching behavior This tests the behavior discussed on the review of #4002. I should have added it there, but I didn't think about it until now. * refactor(gce): fix an import * refactor(gce): remove `static` from a method * refactor(gce): use getAccountName() consistently * docs(gce): remove a TODO It actually does seem to be true that an autoscaler's name always equals that of its associated instance group. This _might_ even be a GCE rule, but it's definitely something we always do in Spinnaker (see UpsertGoogleAutoscalingPolicyAtomicOperation and GCEUtil#buildAutoscaler). * refactor(gce): Prepare zonal caching agent for an abstract superclass About 90% of the code from GoogleZonalServerGroupCachingAgent was just copied into GoogleRegionalServerGroupCachingAgent. I'm going to extract all the common code into an abstract base class. Pretty much all that will be left after I do that are the methods marked `// @Override`. Those methods will be the abstract ones in the superclass. * refactor(gce): Create an AbstractGoogleServerGroupCachingAgent The code is just copy-pasted directly from GoogleZonalServerGroupCachingAgent except that I replaced the methods marked `// @Override` with abstract methods. No other changes were made. * test(gce): Add tests for GoogleRegionalServerGroupCachingAgent * refactor(gce): Convert GoogleRegionalServerGroupCachingAgent to java * refactor(gce): Convert GoogleRegionalServerGroupCachingAgent to java * test(gce): Move server property tests into a test of the abstract class It seems somewhat pointless to have two copies of these. They're essentially just data transformation tests, not really doing anything fancy depending on the subclass. A lot of the other tests could potentially also be merged but I think that would lead to some pretty weird tests that are less useful, so I'd rather keep those separate. * fix(gce): fix a small bug in GoogleRegionalServerGroupCachingAgent This bug is likely pretty innocuous since callers are looking for a specific key amongst the pendingOnDemandRequests and returning an extra one won't hurt anything, but I might as well fix it. It looks like this bug likely exists in other caching agents, too, but since it's very long-standing and the impact is negligible, I'm going to ignore that. * refactor(gce): convert anonymous test class to inner class * refactor(gce): clean up some of the test code
- Loading branch information