Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cell/converger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var _ = Describe("Convergence to desired state", func() {

By("collecting the ActualLRP instance guids")
initialActuals := runningLRPsPoller()
initialInstanceGuids = []string{initialActuals[0].InstanceGuid, initialActuals[1].InstanceGuid}
initialInstanceGuids = []string{initialActuals[0].ActualLrpInstanceKey.InstanceGuid, initialActuals[1].ActualLrpInstanceKey.InstanceGuid}
})

It("marks the LRPs as Suspect until the rep comes back, and then marks the LRPs as Ordinary", func() {
Expand All @@ -120,7 +120,7 @@ var _ = Describe("Convergence to desired state", func() {

By("Asserting that the LRPs marked as Ordinary")
currentActuals := runningLRPsPoller()
instanceGuids := []string{currentActuals[0].InstanceGuid, currentActuals[1].InstanceGuid}
instanceGuids := []string{currentActuals[0].ActualLrpInstanceKey.InstanceGuid, currentActuals[1].ActualLrpInstanceKey.InstanceGuid}
Expect(instanceGuids).NotTo(ContainElement(initialInstanceGuids[0]))
Expect(instanceGuids).NotTo(ContainElement(initialInstanceGuids[1]))
Eventually(runningLRPsPresencePoller(models.ActualLRP_Ordinary)).Should(HaveLen(2))
Expand Down Expand Up @@ -152,8 +152,8 @@ var _ = Describe("Convergence to desired state", func() {
if len(secondActualLRPs) != 2 {
return false
}
return secondActualLRPs[0].CellId != firstActualLRPs[0].CellId &&
secondActualLRPs[1].CellId != firstActualLRPs[1].CellId
return secondActualLRPs[0].ActualLrpInstanceKey.CellId != firstActualLRPs[0].ActualLrpInstanceKey.CellId &&
secondActualLRPs[1].ActualLrpInstanceKey.CellId != firstActualLRPs[1].ActualLrpInstanceKey.CellId
}).Should(BeTrue())
})
})
Expand Down
4 changes: 2 additions & 2 deletions cell/evacuation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ var _ = Describe("Evacuation", func() {
var evacuatingRepPort uint16
var evacuatingRepRunner *ginkgomon.Runner

switch lrps[0].CellId {
switch lrps[0].ActualLrpInstanceKey.CellId {
case cellAID:
evacuatingRepRunner = cellARepRunner
evacuatingRepPort = cellPortsStart
Expand Down Expand Up @@ -232,7 +232,7 @@ var _ = Describe("Evacuation", func() {
// the following requests will hang since garden is stuck trying to destroy the containers
go func() {
for i := 0; i < 100; i++ {
err := client.StopLRPInstance(lgr, lrps[0].ActualLRPKey, lrps[0].ActualLRPInstanceKey)
err := client.StopLRPInstance(lgr, lrps[0].ActualLrpKey, lrps[0].ActualLrpInstanceKey)
if err != nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions cell/instance_identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ var _ = Describe("InstanceIdentity", func() {
actualLRPs, err := bbsClient.ActualLRPs(logger, "", models.ActualLRPFilter{ProcessGuid: processGUID})
Expect(err).NotTo(HaveOccurred())
actualLRP := actualLRPs[0]
container, err = gardenClient.Lookup(actualLRP.InstanceGuid)
container, err = gardenClient.Lookup(actualLRP.ActualLrpInstanceKey.InstanceGuid)
Expect(err).NotTo(HaveOccurred())
})

Expand Down Expand Up @@ -963,7 +963,7 @@ func getContainerInternalAddress(client bbs.Client, processGuid string, port uin
lrps, err := client.ActualLRPs(lgr, "", models.ActualLRPFilter{ProcessGuid: processGuid})
Expect(err).NotTo(HaveOccurred())
Expect(lrps).To(HaveLen(1))
netInfo := lrps[0].ActualLRPNetInfo
netInfo := lrps[0].ActualLrpNetInfo
address := netInfo.InstanceAddress
for _, mapping := range netInfo.Ports {
if mapping.ContainerPort == port {
Expand Down Expand Up @@ -1007,7 +1007,7 @@ func runTaskAndGetCommandOutput(command string, organizationalUnits []string) st
OrganizationalUnit: organizationalUnits,
},
)
expectedTask.ResultFile = resultFile
expectedTask.TaskDefinition.ResultFile = resultFile

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down
8 changes: 4 additions & 4 deletions cell/local_route_emitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ var _ = Describe("LocalRouteEmitter", func() {
Context("to scale the app down", func() {
BeforeEach(func() {
newInstances := int32(1)
desiredLRPUdate.SetInstances(newInstances)
desiredLRPUdate.SetInstances(&newInstances)
})

It("eventually extra routes are removed within a second", func() {
Expand Down Expand Up @@ -311,7 +311,7 @@ var _ = Describe("LocalRouteEmitter", func() {

JustBeforeEach(func() {
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(newInstances)
dlu.SetInstances(&newInstances)
err := bbsClient.UpdateDesiredLRP(lgr, "", processGuid, dlu)
Expect(err).NotTo(HaveOccurred())
})
Expand Down Expand Up @@ -388,7 +388,7 @@ func evacuateARep(
Expect(lrps).To(HaveLen(3))
instancePerRepCount := map[string]int{}
for _, lrp := range lrps {
cellID := lrp.ActualLRPInstanceKey.CellId
cellID := lrp.ActualLrpInstanceKey.CellId
instancePerRepCount[cellID]++
}
repWithOneInstance := ""
Expand Down Expand Up @@ -438,7 +438,7 @@ func evacuateARep(
lrps := helpers.RunningActualLRPs(logger, bbsClient, processGuid)
cellIDs := map[string]int{}
for _, lrp := range lrps {
cellIDs[lrp.CellId]++
cellIDs[lrp.ActualLrpInstanceKey.CellId]++
}
return cellIDs
}).Should(Equal(map[string]int{otherRepID: 3}))
Expand Down
3 changes: 2 additions & 1 deletion cell/long_running_healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ var _ = Context("when declarative healthchecks is turned on", func() {
JustBeforeEach(func() {
Eventually(helpers.LRPStatePoller(lgr, bbsClient, processGuid, nil)).Should(Equal(models.ActualLRPStateRunning))
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(2)
instances := int32(2)
dlu.SetInstances(&instances)
bbsClient.UpdateDesiredLRP(lgr, "", processGuid, dlu)
})

Expand Down
12 changes: 6 additions & 6 deletions cell/lrp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ var _ = Describe("LRP", func() {
Expect(err).NotTo(HaveOccurred())
Expect(len(lrps)).To(BeNumerically(">", 0))

containerHandle := lrps[0].InstanceGuid
containerHandle := lrps[0].ActualLrpInstanceKey.InstanceGuid

container, err := gardenClient.Lookup(containerHandle)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -385,7 +385,7 @@ var _ = Describe("LRP", func() {

JustBeforeEach(func() {
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(newInstances)
dlu.SetInstances(&newInstances)
err := bbsClient.UpdateDesiredLRP(lgr, "", processGuid, dlu)
Expect(err).NotTo(HaveOccurred())
})
Expand Down Expand Up @@ -443,7 +443,7 @@ var _ = Describe("LRP", func() {
It("can be scaled back up", func() {
newInstances := int32(1)
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(newInstances)
dlu.SetInstances(&newInstances)
err := bbsClient.UpdateDesiredLRP(lgr, "", processGuid, dlu)
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -687,7 +687,7 @@ var _ = Describe("LRP", func() {
Expect(err).NotTo(HaveOccurred())
Expect(len(lrps)).To(Equal(1))

err = gardenClient.Destroy(lrps[0].GetInstanceGuid())
err = gardenClient.Destroy(lrps[0].ActualLrpInstanceKey.InstanceGuid)
Expect(err).NotTo(HaveOccurred())
})

Expand All @@ -699,8 +699,8 @@ var _ = Describe("LRP", func() {
It("contains the instance guid and cell id", func() {
Eventually(getEvents).Should(ContainElement(helpers.MatchActualLRPCrashedEvent(
processGuid,
lrps[0].InstanceGuid,
lrps[0].CellId,
lrps[0].ActualLrpInstanceKey.InstanceGuid,
lrps[0].ActualLrpInstanceKey.CellId,
0,
)))
})
Expand Down
4 changes: 2 additions & 2 deletions cell/network_env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var _ = Describe("Network Environment Variables", func() {
Args: []string{"-c", "/usr/bin/env | grep 'CF_INSTANCE' > /home/vcap/env"},
},
)
taskToDesire.ResultFile = "/home/vcap/env"
taskToDesire.TaskDefinition.ResultFile = "/home/vcap/env"

err := bbsClient.DesireTask(lgr, "", taskToDesire.TaskGuid, taskToDesire.Domain, taskToDesire.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -132,7 +132,7 @@ var _ = Describe("Network Environment Variables", func() {
})

It("sets the networking environment variables", func() {
netInfo := actualLRP.ActualLRPNetInfo
netInfo := actualLRP.ActualLrpNetInfo
Expect(response).To(ContainSubstring(fmt.Sprintf("CF_INSTANCE_ADDR=%s:%d\n", netInfo.Address, netInfo.Ports[0].HostPort)))
Expect(response).To(ContainSubstring(fmt.Sprintf("CF_INSTANCE_IP=%s\n", os.Getenv("EXTERNAL_ADDRESS"))))
Expect(response).To(ContainSubstring(fmt.Sprintf("CF_INSTANCE_INTERNAL_IP=%s\n", netInfo.InstanceAddress)))
Expand Down
6 changes: 3 additions & 3 deletions cell/placement_tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var _ = Describe("Placement Tags", func() {
if len(lrps) == 0 {
return ""
}
return lrps[0].CellId
return lrps[0].ActualLrpInstanceKey.CellId
}
Eventually(lrpFunc).Should(MatchRegexp("the-cell-id-.*-0"))
Eventually(helpers.LRPStatePoller(lgr, bbsClient, guid, nil)).Should(Equal(models.ActualLRPStateRunning))
Expand All @@ -108,7 +108,7 @@ var _ = Describe("Placement Tags", func() {
if len(lrps) == 0 {
return ""
}
return lrps[0].CellId
return lrps[0].ActualLrpInstanceKey.CellId
}
Eventually(lrpFunc).Should(MatchRegexp("the-cell-id-.*-0"))
Eventually(helpers.LRPStatePoller(lgr, bbsClient, guid, nil)).Should(Equal(models.ActualLRPStateRunning))
Expand All @@ -127,7 +127,7 @@ var _ = Describe("Placement Tags", func() {
if len(lrps) == 0 {
return ""
}
lgr.Info("lrp-cell-id", lager.Data{"cell-id": lrps[0].CellId})
lgr.Info("lrp-cell-id", lager.Data{"cell-id": lrps[0].ActualLrpInstanceKey.CellId})

return lrps[0].PlacementError
}
Expand Down
4 changes: 2 additions & 2 deletions cell/privileges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var _ = Describe("Privileges", func() {

Context("when the task is privileged", func() {
BeforeEach(func() {
taskToDesire.Privileged = true
taskToDesire.TaskDefinition.Privileged = true
})

It("succeeds", func() {
Expand All @@ -82,7 +82,7 @@ var _ = Describe("Privileges", func() {

Context("when the task is not privileged", func() {
BeforeEach(func() {
taskToDesire.Privileged = false
taskToDesire.TaskDefinition.Privileged = false
})

It("fails", func() {
Expand Down
2 changes: 1 addition & 1 deletion cell/task_as_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var _ = Describe("Tasks as specific user", func() {
Args: []string{"-c", `[ $(whoami) = testuser ]`},
},
)
expectedTask.Privileged = true
expectedTask.TaskDefinition.Privileged = true
err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())

Expand Down
4 changes: 2 additions & 2 deletions cell/task_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ exit 0
},
},
)
taskToCreate.ResultFile = "/tmp/result"
taskToCreate.TaskDefinition.ResultFile = "/tmp/result"
})

JustBeforeEach(func() {
Expand All @@ -267,7 +267,7 @@ exit 0

Context("with appropriate security group setting", func() {
BeforeEach(func() {
taskToCreate.EgressRules = []*models.SecurityGroupRule{
taskToCreate.TaskDefinition.EgressRules = []*models.SecurityGroupRule{
{
Protocol: models.TCPProtocol,
Destinations: []string{"9.0.0.0-89.255.255.255", "90.0.0.0-94.0.0.0"},
Expand Down
46 changes: 23 additions & 23 deletions cell/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = Describe("Tasks", func() {
},
},
)
expectedTask.Privileged = true
expectedTask.TaskDefinition.Privileged = true

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -104,7 +104,7 @@ var _ = Describe("Tasks", func() {
Dir: "/tmp",
},
)
expectedTask.Privileged = true
expectedTask.TaskDefinition.Privileged = true

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)

Expand Down Expand Up @@ -150,16 +150,16 @@ var _ = Describe("Tasks", func() {
Args: []string{"--dockerRef", privateRef, "--dockerUser", privateUser, "--dockerPassword", privatePassword, "--outputMetadataJSONFilename", "/tmp/result.json"},
},
)
expectedTask.CachedDependencies = []*models.CachedDependency{{
expectedTask.TaskDefinition.CachedDependencies = []*models.CachedDependency{{
From: fmt.Sprintf("http://%s/v1/static/docker_app_lifecycle/docker_app_lifecycle.tgz", componentMaker.Addresses().FileServer),
To: "/tmp/diego/dockerapplifecycle",
Name: "docker app lifecycle",
CacheKey: "docker-app-lifecycle",
LogSource: "docker-app-lifecycle",
}}
expectedTask.Privileged = true
expectedTask.ResultFile = "/tmp/result.json"
expectedTask.EgressRules = []*models.SecurityGroupRule{
expectedTask.TaskDefinition.Privileged = true
expectedTask.TaskDefinition.ResultFile = "/tmp/result.json"
expectedTask.TaskDefinition.EgressRules = []*models.SecurityGroupRule{
{
// allow traffic to the docker registry
Protocol: models.AllProtocol,
Expand Down Expand Up @@ -200,10 +200,10 @@ var _ = Describe("Tasks", func() {
},
},
)
expectedTask.Privileged = true
expectedTask.RootFs = privateDockerRootFSPath
expectedTask.ImageUsername = privateUser
expectedTask.ImagePassword = privatePassword
expectedTask.TaskDefinition.Privileged = true
expectedTask.TaskDefinition.RootFs = privateDockerRootFSPath
expectedTask.TaskDefinition.ImageUsername = privateUser
expectedTask.TaskDefinition.ImagePassword = privatePassword

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -249,16 +249,16 @@ var _ = Describe("Tasks", func() {
Args: []string{"--dockerRef", imageRef, "--dockerUser", imageUsername, "--dockerPassword", imagePassword, "--outputMetadataJSONFilename", "/tmp/result.json"},
},
)
expectedTask.CachedDependencies = []*models.CachedDependency{{
expectedTask.TaskDefinition.CachedDependencies = []*models.CachedDependency{{
From: fmt.Sprintf("http://%s/v1/static/docker_app_lifecycle/docker_app_lifecycle.tgz", componentMaker.Addresses().FileServer),
To: "/tmp/diego/dockerapplifecycle",
Name: "docker app lifecycle",
CacheKey: "docker-app-lifecycle",
LogSource: "docker-app-lifecycle",
}}
expectedTask.Privileged = true
expectedTask.ResultFile = "/tmp/result.json"
expectedTask.EgressRules = []*models.SecurityGroupRule{
expectedTask.TaskDefinition.Privileged = true
expectedTask.TaskDefinition.ResultFile = "/tmp/result.json"
expectedTask.TaskDefinition.EgressRules = []*models.SecurityGroupRule{
{
// allow traffic to the docker registry
Protocol: models.AllProtocol,
Expand Down Expand Up @@ -299,10 +299,10 @@ var _ = Describe("Tasks", func() {
},
},
)
expectedTask.Privileged = true
expectedTask.RootFs = imageRootFSPath
expectedTask.ImageUsername = imageUsername
expectedTask.ImagePassword = imagePassword
expectedTask.TaskDefinition.Privileged = true
expectedTask.TaskDefinition.RootFs = imageRootFSPath
expectedTask.TaskDefinition.ImageUsername = imageUsername
expectedTask.TaskDefinition.ImagePassword = imagePassword

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -375,7 +375,7 @@ var _ = Describe("Tasks", func() {
nofile := uint64(10)

rl := &models.ResourceLimits{}
rl.SetNofile(nofile)
rl.SetNofile(&nofile)

expectedTask := helpers.TaskCreateRequest(
guid,
Expand Down Expand Up @@ -500,7 +500,7 @@ echo should have died by now
},
},
)
expectedTask.Network = &models.Network{
expectedTask.TaskDefinition.Network = &models.Network{
Properties: map[string]string{
"some-key": "some-value",
},
Expand Down Expand Up @@ -675,11 +675,11 @@ echo should have died by now
},
)

expectedTask.CachedDependencies = []*models.CachedDependency{
expectedTask.TaskDefinition.CachedDependencies = []*models.CachedDependency{
cachedDependency,
}

expectedTask.Privileged = true
expectedTask.TaskDefinition.Privileged = true
})

Context("with no checksum", func() {
Expand Down Expand Up @@ -850,7 +850,7 @@ echo should have died by now
Args: []string{"-c", "echo tasty thingy > thingy"},
},
)
expectedTask.ResultFile = "/home/vcap/thingy"
expectedTask.TaskDefinition.ResultFile = "/home/vcap/thingy"

err := bbsClient.DesireTask(lgr, "", expectedTask.TaskGuid, expectedTask.Domain, expectedTask.TaskDefinition)
Expect(err).NotTo(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion helpers/bbs_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TaskCreateRequest(taskGuid string, action models.ActionInterface) *models.T

func TaskCreateRequestWithTags(taskGuid string, action models.ActionInterface, tags []string) *models.Task {
task := taskCreateRequest(taskGuid, defaultPreloadedRootFS, action, 0, 0, nil)
task.PlacementTags = tags
task.TaskDefinition.PlacementTags = tags
return task
}

Expand Down
Loading