Skip to content

Commit

Permalink
fix(gce): remove the duplicate cache attribute "subnet" and update th…
Browse files Browse the repository at this point in the history
…e test (#5977) (#5985)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit ace11c4)

Co-authored-by: Kiran Godishala <[email protected]>
  • Loading branch information
mergify[bot] and kirangodishala authored Jul 25, 2023
1 parent 2ae5fb9 commit 010b360
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GoogleSubnetCachingAgent extends AbstractGoogleCachingAgent {
def subnetKey = Keys.getSubnetKey(deriveSubnetId(subnet), region, accountName)

cacheResultBuilder.namespace(SUBNETS.ns).keep(subnetKey).with {
attributes.subnet = [subnet: subnet,project: project]
attributes = [subnet: subnet,project: project]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ class GoogleSubnetCachingAgentSpec extends Specification {
1 * computeMock.subnetworks() >> subnetsMock
1 * subnetsMock.list(PROJECT_NAME,REGION) >> subnetworksListMock
1 * subnetworksListMock.execute() >> SubnetsListReal
with(cache.cacheResults.get(Keys.Namespace.SUBNETS.ns)) { Collection<CacheData> cd ->
cd.stream().forEach( {
Map<String,Object> attributes= it.getAttributes()
attributes.get(0) == "my-project"
})
cd.id.containsAll([keyGroupA])
def cd = cache.cacheResults.get(Keys.Namespace.SUBNETS.ns)
cd.id.containsAll([keyGroupA])
with(cd.asList().get(0)){
def attributes = it.attributes
attributes.project == "my-project"
attributes.subnet.name == "name-a"
attributes.subnet.selfLink == "https://compute.googleapis.com/compute/v1/projects/my-project/us-east1/subnetworks/name-a"
}
}

Expand Down

0 comments on commit 010b360

Please sign in to comment.