Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
hoffmaen committed Dec 12, 2024
commit 8c017fb31ed7a099c6ac446fa636d95aff0c7f79
10 changes: 5 additions & 5 deletions metrics/metricsreporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ var _ = Describe("MetricsReporter", func() {
metricReporter.CaptureRegistryMessage(endpoint, "some-action")

Expect(batcher.BatchIncrementCounterCallCount()).To(Equal(2))
Expect(batcher.BatchIncrementCounterArgsForCall(0)).To(Equal("registry_message.uaa.some-action"))
Expect(batcher.BatchIncrementCounterArgsForCall(1)).To(Equal("registry_message.route-emitter.some-action"))
Expect(batcher.BatchIncrementCounterArgsForCall(0)).To(Equal("registry_message.some-action.uaa"))
Expect(batcher.BatchIncrementCounterArgsForCall(1)).To(Equal("registry_message.some-action.route-emitter"))
})

It("sends the total routes", func() {
Expand Down Expand Up @@ -522,7 +522,7 @@ var _ = Describe("MetricsReporter", func() {

It("increments the counter metric", func() {
Expect(sender.IncrementCounterCallCount()).To(Equal(1))
Expect(sender.IncrementCounterArgsForCall(0)).To(Equal("unregistry_message.oauth-server.some-action"))
Expect(sender.IncrementCounterArgsForCall(0)).To(Equal("unregistry_message.some-action.oauth-server"))
})

It("increments the counter metric for each component unregistered", func() {
Expand All @@ -531,8 +531,8 @@ var _ = Describe("MetricsReporter", func() {
metricReporter.CaptureUnregistryMessage(endpointTwo, "some-action")

Expect(sender.IncrementCounterCallCount()).To(Equal(2))
Expect(sender.IncrementCounterArgsForCall(0)).To(Equal("unregistry_message.oauth-server.some-action"))
Expect(sender.IncrementCounterArgsForCall(1)).To(Equal("unregistry_message.api-server.some-action"))
Expect(sender.IncrementCounterArgsForCall(0)).To(Equal("unregistry_message.some-action.oauth-server"))
Expect(sender.IncrementCounterArgsForCall(1)).To(Equal("unregistry_message.some-action.api-server"))
})
})
Context("when unregister msg with empty component name is incremented", func() {
Expand Down
16 changes: 8 additions & 8 deletions proxy/round_tripper/proxy_round_tripper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ var _ = Describe("ProxyRoundTripper", func() {
Context("when there are no more endpoints available", func() {
JustBeforeEach(func() {
removed := routePool.Remove(endpoint)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))
})

It("returns a 502 Bad Gateway response", func() {
Expand Down Expand Up @@ -1147,7 +1147,7 @@ var _ = Describe("ProxyRoundTripper", func() {
added = routePool.Put(endpoint2)
Expect(added).To(Equal(route.Added))
removed := routePool.Remove(endpoint)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))
})

Context("when there are no cookies on the request", func() {
Expand Down Expand Up @@ -1439,10 +1439,10 @@ var _ = Describe("ProxyRoundTripper", func() {

JustBeforeEach(func() {
removed := routePool.Remove(endpoint1)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

removed = routePool.Remove(endpoint2)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

new_endpoint := route.NewEndpoint(&route.EndpointOpts{PrivateInstanceId: "id-5"})
added := routePool.Put(new_endpoint)
Expand Down Expand Up @@ -1502,10 +1502,10 @@ var _ = Describe("ProxyRoundTripper", func() {

JustBeforeEach(func() {
removed := routePool.Remove(endpoint1)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

removed = routePool.Remove(endpoint2)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

new_endpoint := route.NewEndpoint(&route.EndpointOpts{PrivateInstanceId: "id-5"})
added := routePool.Put(new_endpoint)
Expand Down Expand Up @@ -1568,10 +1568,10 @@ var _ = Describe("ProxyRoundTripper", func() {

JustBeforeEach(func() {
removed := routePool.Remove(endpoint1)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

removed = routePool.Remove(endpoint2)
Expect(removed).To(BeTrue())
Expect(removed).To(Equal(route.EndpointUnregistered))

new_endpoint := route.NewEndpoint(&route.EndpointOpts{PrivateInstanceId: "id-5"})
added := routePool.Put(new_endpoint)
Expand Down
8 changes: 4 additions & 4 deletions registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var _ = Describe("RouteRegistry", func() {
Expect(reporter.CaptureRegistryMessageCallCount()).To(Equal(1))
endpoint1, action1 := reporter.CaptureRegistryMessageArgsForCall(0)
Expect(endpoint1).To(Equal(fooEndpoint))
Expect(action1).To(Equal("endpoint-registered"))
Expect(action1).To(Equal("endpoint-added"))
})
})

Expand All @@ -91,7 +91,7 @@ var _ = Describe("RouteRegistry", func() {
Expect(reporter.CaptureRegistryMessageCallCount()).To(Equal(2))
endpointR1, action1 := reporter.CaptureRegistryMessageArgsForCall(0)
Expect(endpointR1).To(Equal(endpoint1))
Expect(action1).To(Equal("endpoint-registered"))
Expect(action1).To(Equal("endpoint-added"))
endpointR2, action2 := reporter.CaptureRegistryMessageArgsForCall(1)
Expect(endpointR2).To(Equal(endpoint2))
Expect(action2).To(Equal("endpoint-updated"))
Expand All @@ -109,7 +109,7 @@ var _ = Describe("RouteRegistry", func() {
Expect(reporter.CaptureRegistryMessageCallCount()).To(Equal(2))
endpointR1, action1 := reporter.CaptureRegistryMessageArgsForCall(0)
Expect(endpointR1).To(Equal(endpoint1))
Expect(action1).To(Equal("endpoint-registered"))
Expect(action1).To(Equal("endpoint-added"))
endpointR2, action2 := reporter.CaptureRegistryMessageArgsForCall(1)
Expect(endpointR2).To(Equal(endpoint2))
Expect(action2).To(Equal("endpoint-not-updated"))
Expand Down Expand Up @@ -278,7 +278,7 @@ var _ = Describe("RouteRegistry", func() {
r.Register("a.route", fooEndpoint)

Eventually(logger).Should(gbytes.Say(`"log_level":1.*route-registered.*a\.route`))
Eventually(logger).Should(gbytes.Say(`"log_level":1.*endpoint-registered.*a\.route.*192\.168\.1\.1`))
Eventually(logger).Should(gbytes.Say(`"log_level":1.*endpoint-added.*a\.route.*192\.168\.1\.1`))
})

It("logs 'uri-added' at debug level for backward compatibility", func() {
Expand Down