Skip to content

Commit

Permalink
fix(provider/cf): fix regression caused by clusterSummaries (#4991)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Woo <kevinawoo@gmail.com>
  • Loading branch information
zachsmith1 and kevinawoo committed Oct 7, 2020
1 parent f4371a4 commit ad84606
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Expand Up @@ -105,7 +105,7 @@ private CloudFoundryCluster clusterFromCacheData(CacheData clusterData, Detail d
CloudFoundryCluster cluster =
objectMapper.convertValue(
clusterData.getAttributes().get("resource"), CloudFoundryCluster.class);
if (detail.equals(Detail.NONE) || detail.equals(Detail.NAMES_ONLY)) {
if (detail.equals(Detail.NONE)) {
return cluster.withServerGroups(emptySet());
}
return cluster.withServerGroups(
Expand Down
Expand Up @@ -65,7 +65,7 @@ public Map<String, Set<CloudFoundryCluster>> getClusterSummaries(String applicat
repository.findClustersByKeys(
cacheView.filterIdentifiers(
CLUSTERS.getNs(), Keys.getClusterKey("*", applicationName, "*")),
CacheRepository.Detail.NAMES_ONLY));
CacheRepository.Detail.NONE));
}

@Override
Expand Down
Expand Up @@ -18,6 +18,7 @@

import static com.netflix.spinnaker.clouddriver.cloudfoundry.cache.CacheRepository.Detail.FULL;
import static com.netflix.spinnaker.clouddriver.cloudfoundry.cache.CacheRepository.Detail.NAMES_ONLY;
import static com.netflix.spinnaker.clouddriver.cloudfoundry.cache.CacheRepository.Detail.NONE;
import static java.util.Collections.*;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -157,6 +158,16 @@ void findCluster() {
});

assertThat(repo.findClusterByKey(clusterKey, NAMES_ONLY))
.hasValueSatisfying(
cluster ->
assertThat(cluster.getServerGroups())
.hasOnlyOneElementSatisfying(
serverGroup -> {
assertThat(serverGroup.getLoadBalancers()).isEmpty();
assertThat(serverGroup.getInstances()).isNotEmpty();
}));

assertThat(repo.findClusterByKey(clusterKey, NONE))
.hasValueSatisfying(cluster -> assertThat(cluster.getServerGroups()).isEmpty());
}

Expand Down

0 comments on commit ad84606

Please sign in to comment.