Skip to content
This repository was archived by the owner on Sep 10, 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
2 changes: 1 addition & 1 deletion actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var _ = Describe("Actions", func() {
BeforeEach(func() {
taskDef = Task()
rl := &models.ResourceLimits{}
rl.SetNofile(processLimit)
rl.SetNofile(&processLimit)
taskDef.Action = models.WrapAction(&models.RunAction{
Path: "bash",
Dir: "/etc",
Expand Down
10 changes: 5 additions & 5 deletions container_environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = Describe("The container environment", func() {
envs := getEnvs(url)

Expect(envs).To(ContainElement([]string{"INSTANCE_INDEX", "0"}))
Expect(envs).To(ContainElement([]string{"INSTANCE_GUID", actualLRP.InstanceGuid}))
Expect(envs).To(ContainElement([]string{"INSTANCE_GUID", actualLRP.ActualLrpInstanceKey.InstanceGuid}))
})
})

Expand All @@ -58,14 +58,14 @@ var _ = Describe("The container environment", func() {
}

cfPortMappingPayload, err := json.Marshal([]cfPortMapping{
{Internal: actualLRP.Ports[0].ContainerPort, ExternalTLS: actualLRP.Ports[0].HostTlsProxyPort, InternalTLS: actualLRP.Ports[0].ContainerTlsProxyPort},
{Internal: actualLRP.Ports[1].ContainerPort, ExternalTLS: actualLRP.Ports[1].HostTlsProxyPort, InternalTLS: actualLRP.Ports[1].ContainerTlsProxyPort},
{Internal: actualLRP.Ports[2].ContainerPort, ExternalTLS: actualLRP.Ports[2].HostTlsProxyPort, InternalTLS: actualLRP.Ports[2].ContainerTlsProxyPort},
{Internal: actualLRP.ActualLrpNetInfo.Ports[0].ContainerPort, ExternalTLS: actualLRP.ActualLrpNetInfo.Ports[0].HostTlsProxyPort, InternalTLS: actualLRP.ActualLrpNetInfo.Ports[0].ContainerTlsProxyPort},
{Internal: actualLRP.ActualLrpNetInfo.Ports[1].ContainerPort, ExternalTLS: actualLRP.ActualLrpNetInfo.Ports[1].HostTlsProxyPort, InternalTLS: actualLRP.ActualLrpNetInfo.Ports[1].ContainerTlsProxyPort},
{Internal: actualLRP.ActualLrpNetInfo.Ports[2].ContainerPort, ExternalTLS: actualLRP.ActualLrpNetInfo.Ports[2].HostTlsProxyPort, InternalTLS: actualLRP.ActualLrpNetInfo.Ports[2].ContainerTlsProxyPort},
})
Expect(err).NotTo(HaveOccurred())

envs := getEnvs(url)
Expect(envs).To(ContainElement([]string{"CF_INSTANCE_IP", actualLRP.Address}), "If this fails, then your executor may not be configured to expose ip:port to the container")
Expect(envs).To(ContainElement([]string{"CF_INSTANCE_IP", actualLRP.ActualLrpNetInfo.Address}), "If this fails, then your executor may not be configured to expose ip:port to the container")
Expect(envs).To(ContainElement([]string{"CF_INSTANCE_PORTS", string(cfPortMappingPayload)}))
})

Expand Down
4 changes: 2 additions & 2 deletions crashes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var _ = Describe("Crashes", func() {

restartedActualLRP, err := ActualLRPByProcessGuidAndIndex(logger, guid, 0)
Expect(err).NotTo(HaveOccurred())
Expect(restartedActualLRP.InstanceGuid).NotTo(Equal(actualLRP.InstanceGuid))
Expect(restartedActualLRP.ActualLrpInstanceKey.InstanceGuid).NotTo(Equal(actualLRP.ActualLrpInstanceKey.InstanceGuid))
Expect(restartedActualLRP.ModificationTag.Epoch).To(Equal(tag.Epoch))
Expect(restartedActualLRP.ModificationTag.Index).To(BeNumerically(">", tag.Index))

Expand Down Expand Up @@ -491,7 +491,7 @@ var _ = Describe("Crashes", func() {
actualLRP, err := ActualLRPByProcessGuidAndIndex(logger, guid, 0)
Expect(err).ToNot(HaveOccurred())

tlsConfig, err := containerProxyTLSConfig(actualLRP.InstanceGuid)
tlsConfig, err := containerProxyTLSConfig(actualLRP.ActualLrpInstanceKey.InstanceGuid)
Expect(err).NotTo(HaveOccurred())

httpClient := &http.Client{
Expand Down
4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ func TLSDirectAddressFor(guid string, index int, containerPort uint32) string {
Expect(err).NotTo(HaveOccurred())
Expect(actualLRP).NotTo(BeZero())

for _, portMapping := range actualLRP.Ports {
for _, portMapping := range actualLRP.ActualLrpNetInfo.Ports {
if portMapping.ContainerPort == containerPort {
return fmt.Sprintf("%s:%d", actualLRP.Address, portMapping.HostTlsProxyPort)
return fmt.Sprintf("%s:%d", actualLRP.ActualLrpNetInfo.Address, portMapping.HostTlsProxyPort)
}
}

Expand Down
23 changes: 15 additions & 8 deletions lrps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ var _ = Describe("LRPs", func() {
Expect(bbsClient.DesireLRP(logger, traceID, lrp)).To(Succeed())

dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(2)
instances := int32(2)
dlu.SetInstances(&instances)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, lrp.ProcessGuid, dlu)).To(Succeed())

Eventually(IndexCounter(guid)).Should(Equal(2))
Expand Down Expand Up @@ -355,15 +356,17 @@ var _ = Describe("LRPs", func() {
Context("when the LRP exists", func() {
It("allows updating instances", func() {
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(2)
instances := int32(2)
dlu.SetInstances(&instances)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, guid, dlu)).To(Succeed())

Eventually(IndexCounter(guid)).Should(Equal(2))
})

It("allows scaling down to 0", func() {
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(0)
instances := int32(0)
dlu.SetInstances(&instances)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, guid, dlu)).To(Succeed())

Eventually(IndexCounter(guid)).Should(Equal(0))
Expand All @@ -388,7 +391,7 @@ var _ = Describe("LRPs", func() {
It("allows updating annotations", func() {
annotation := "my new annotation"
dlu := &models.DesiredLRPUpdate{}
dlu.SetAnnotation(annotation)
dlu.SetAnnotation(&annotation)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, guid, dlu)).To(Succeed())

lrp, err := bbsClient.DesiredLRPByProcessGuid(logger, traceID, guid)
Expand All @@ -406,8 +409,10 @@ var _ = Describe("LRPs", func() {
routingInfo := routes.RoutingInfo()

dlu := &models.DesiredLRPUpdate{Routes: &routingInfo}
dlu.SetInstances(2)
dlu.SetAnnotation("my new annotation")
instances := int32(2)
dlu.SetInstances(&instances)
annotation := "my new annotation"
dlu.SetAnnotation(&annotation)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, guid, dlu)).To(Succeed())

Eventually(IndexCounter(guid)).Should(Equal(2))
Expand All @@ -428,7 +433,8 @@ var _ = Describe("LRPs", func() {

By("modifying when a change is made")
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(2)
instances := int32(2)
dlu.SetInstances(&instances)
Expect(bbsClient.UpdateDesiredLRP(logger, traceID, guid, dlu)).To(Succeed())

Eventually(IndexCounter(guid)).Should(Equal(2))
Expand All @@ -443,7 +449,8 @@ var _ = Describe("LRPs", func() {
Context("when the LRP does not exist", func() {
It("errors", func() {
dlu := &models.DesiredLRPUpdate{}
dlu.SetInstances(2)
instances := int32(2)
dlu.SetInstances(&instances)
err := bbsClient.UpdateDesiredLRP(logger, traceID, "flooberdoobey", dlu)
Expect(models.ConvertError(err).Type).To(Equal(models.Error_ResourceNotFound))
})
Expand Down
2 changes: 1 addition & 1 deletion matchers/be_actual_lrp.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (matcher *BeActualLRPMatcher) Match(actual interface{}) (success bool, err
matchesPlacementErrorRequirement = lrp.PlacementError != ""
}

return matchesPlacementErrorRequirement && matchesState && matchesCrashCount && lrp.ProcessGuid == matcher.ProcessGuid && int(lrp.Index) == matcher.Index, nil
return matchesPlacementErrorRequirement && matchesState && matchesCrashCount && lrp.ActualLrpKey.ProcessGuid == matcher.ProcessGuid && int(lrp.ActualLrpKey.Index) == matcher.Index, nil
}

func (matcher *BeActualLRPMatcher) expectedContents() string {
Expand Down
6 changes: 3 additions & 3 deletions matchers/match_bbs_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (matcher *ActualLRPInstanceCreatedEventMatcher) Match(actual interface{}) (
return false, fmt.Errorf("ActualLRPInstanceCreatedEventMatcher matcher expects a models.ActualLRPInstanceCreatedEvent. Got:\n%s", format.Object(actual, 1))
}
actualLRP := event.ActualLrp
return actualLRP.ProcessGuid == matcher.ProcessGuid && actualLRP.Index == int32(matcher.Index), nil
return actualLRP.ActualLrpKey.ProcessGuid == matcher.ProcessGuid && actualLRP.ActualLrpKey.Index == int32(matcher.Index), nil
}

func (matcher *ActualLRPInstanceCreatedEventMatcher) FailureMessage(actual interface{}) (message string) {
Expand Down Expand Up @@ -144,7 +144,7 @@ func (matcher *ActualLRPInstanceChangedEventMatcher) Match(actual interface{}) (
return false, fmt.Errorf("ActualLRPInstanceChangedEventMatcher matcher expects a models.ActualLRPInstanceChangedEvent. Got:\n%s", format.Object(actual, 1))
}

actualLRP := event.ActualLRPKey
actualLRP := event.ActualLrpKey
if err != nil {
return false, err
}
Expand Down Expand Up @@ -179,7 +179,7 @@ func (matcher *ActualLRPInstanceRemovedEventMatcher) Match(actual interface{}) (
return false, fmt.Errorf("ActualLRPInstanceRemovedEventMatcher matcher expects a models.ActualLRPInstanceRemovedEvent. Got:\n%s", format.Object(actual, 1))
}
actualLRP := event.ActualLrp
return actualLRP.ProcessGuid == matcher.ProcessGuid && actualLRP.Index == int32(matcher.Index), nil
return actualLRP.ActualLrpKey.ProcessGuid == matcher.ProcessGuid && actualLRP.ActualLrpKey.Index == int32(matcher.Index), nil
}

func (matcher *ActualLRPInstanceRemovedEventMatcher) FailureMessage(actual interface{}) (message string) {
Expand Down
16 changes: 10 additions & 6 deletions routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ var _ = Describe("Routing Related Tests", func() {
}()

updateToThree := models.DesiredLRPUpdate{}
updateToThree.SetInstances(3)
threeInstances := int32(3)
updateToThree.SetInstances(&threeInstances)

updateToOne := models.DesiredLRPUpdate{}
updateToOne.SetInstances(1)
oneInstance := int32(1)
updateToOne.SetInstances(&oneInstance)

for i := 0; i < 4; i++ {
By(fmt.Sprintf("Scaling down then back up #%d", i+1))
Expand Down Expand Up @@ -227,8 +229,9 @@ var _ = Describe("Routing Related Tests", func() {
}()

dlu := &models.DesiredLRPUpdate{Routes: lrp.Routes}
dlu.SetInstances(0)
dlu.SetAnnotation(lrp.Annotation)
instances := int32(0)
dlu.SetInstances(&instances)
dlu.SetAnnotation(&lrp.Annotation)

Expect(bbsClient.UpdateDesiredLRP(logger, traceID, lrp.ProcessGuid, dlu)).To(Succeed())

Expand All @@ -238,8 +241,9 @@ var _ = Describe("Routing Related Tests", func() {

It("quickly stops routing to the removed indices", func() {
dlu := &models.DesiredLRPUpdate{Routes: lrp.Routes}
dlu.SetInstances(1)
dlu.SetAnnotation(lrp.Annotation)
instances := int32(1)
dlu.SetInstances(&instances)
dlu.SetAnnotation(&lrp.Annotation)

Expect(bbsClient.UpdateDesiredLRP(logger, traceID, lrp.ProcessGuid, dlu)).To(Succeed())

Expand Down
6 changes: 3 additions & 3 deletions tls_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _ = Describe("TLS Proxy", func() {
It("proxies traffic to the application process inside the container", func() {
directURL := "https://" + TLSDirectAddressFor(guid, 0, 8080)

tlsConfig, err := containerProxyTLSConfig(actualLRP.InstanceGuid)
tlsConfig, err := containerProxyTLSConfig(actualLRP.ActualLrpInstanceKey.InstanceGuid)
Expect(err).NotTo(HaveOccurred())

client := http.Client{
Expand All @@ -60,7 +60,7 @@ var _ = Describe("TLS Proxy", func() {
)

BeforeEach(func() {
tlsConfig, err := containerProxyTLSConfig(actualLRP.InstanceGuid)
tlsConfig, err := containerProxyTLSConfig(actualLRP.ActualLrpInstanceKey.InstanceGuid)
Expect(err).NotTo(HaveOccurred())

conn, err := tls.Dial("tcp", TLSDirectAddressFor(guid, 0, 8080), tlsConfig)
Expand All @@ -76,7 +76,7 @@ var _ = Describe("TLS Proxy", func() {
})

It("has a common name that matches the instance guid", func() {
Expect(certs[0].Subject.CommonName).To(Equal(actualLRP.InstanceGuid))
Expect(certs[0].Subject.CommonName).To(Equal(actualLRP.ActualLrpInstanceKey.InstanceGuid))
})
})
})
Expand Down