diff --git a/actions_test.go b/actions_test.go index 959517e..d985aba 100644 --- a/actions_test.go +++ b/actions_test.go @@ -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", diff --git a/container_environment_test.go b/container_environment_test.go index 73c00dd..4d99cd2 100644 --- a/container_environment_test.go +++ b/container_environment_test.go @@ -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})) }) }) @@ -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)})) }) diff --git a/crashes_test.go b/crashes_test.go index cb5b0a7..c5d1f62 100644 --- a/crashes_test.go +++ b/crashes_test.go @@ -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)) @@ -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{ diff --git a/helpers_test.go b/helpers_test.go index bda2c13..f48083c 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -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) } } diff --git a/lrps_test.go b/lrps_test.go index b1905d8..1863344 100644 --- a/lrps_test.go +++ b/lrps_test.go @@ -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)) @@ -355,7 +356,8 @@ 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)) @@ -363,7 +365,8 @@ var _ = Describe("LRPs", func() { 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)) @@ -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) @@ -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)) @@ -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)) @@ -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)) }) diff --git a/matchers/be_actual_lrp.go b/matchers/be_actual_lrp.go index 534a932..f9a4835 100644 --- a/matchers/be_actual_lrp.go +++ b/matchers/be_actual_lrp.go @@ -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 { diff --git a/matchers/match_bbs_event.go b/matchers/match_bbs_event.go index 648c644..65f00ee 100644 --- a/matchers/match_bbs_event.go +++ b/matchers/match_bbs_event.go @@ -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) { @@ -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 } @@ -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) { diff --git a/routing_test.go b/routing_test.go index b5ed230..8a1fd96 100644 --- a/routing_test.go +++ b/routing_test.go @@ -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)) @@ -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()) @@ -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()) diff --git a/tls_proxy_test.go b/tls_proxy_test.go index 61ddfd2..4ab19d7 100644 --- a/tls_proxy_test.go +++ b/tls_proxy_test.go @@ -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{ @@ -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) @@ -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)) }) }) })