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
…5010)

Co-authored-by: Kevin Woo <kevinawoo@gmail.com>
(cherry picked from commit ad84606)

Co-authored-by: Zach Smith <33258732+zachsmith1@users.noreply.github.com>
  • Loading branch information
mergify[bot] and zachsmith1 committed Oct 12, 2020
1 parent 618921b commit 2a00ac4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2a00ac4

Please sign in to comment.