Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit a795691

Browse files
committed
fix broken test
Signed-off-by: Sean Teeling <[email protected]>
1 parent 0e8c653 commit a795691

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

cmd/osm-healthcheck/osm-healthcheck_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func TestGetHealthcheckHander(t *testing.T) {
5858
//#nosec G307
5959
defer listener.Close()
6060

61+
// required to avoid https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables
62+
test := test
6163
go func() {
6264
conn, err := listener.Accept()
6365
assert.Nil(err)

pkg/envoy/ads/response_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ var _ = Describe("Test ADS response functions", func() {
172172
CertType: secrets.ServiceCertType,
173173
}.String()))
174174

175-
Expect(metricsstore.DefaultMetricsStore.Contains(fmt.Sprintf("osm_proxy_response_send_success_count{proxy_name=%q,type=%q} 1\n", proxy.GetName(), envoy.TypeCDS))).To(BeTrue())
175+
Expect(metricsstore.DefaultMetricsStore.Contains(fmt.Sprintf("osm_proxy_response_send_success_count{identity=%q,proxy_uuid=%q,type=%q} 1\n", proxy.Identity, proxy.UUID, envoy.TypeCDS))).To(BeTrue())
176176
})
177177
})
178178

pkg/envoy/cds/response_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func TestNewResponse(t *testing.T) {
119119
_, err := kubeClient.CoreV1().Pods(tests.Namespace).Create(context.TODO(), newPod1, metav1.CreateOptions{})
120120
assert.Nil(err)
121121

122-
mockKubeController.EXPECT().GetPodForProxy(proxy).Return(&newPod1, nil)
122+
mockKubeController.EXPECT().GetPodForProxy(proxy).Return(newPod1, nil)
123123

124124
resp, err := NewResponse(mockCatalog, proxy, nil, mockConfigurator, nil, proxyRegistry)
125125
assert.Nil(err)

pkg/envoy/registry/services_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var _ = Describe("Test Proxy-Service mapping", func() {
113113
}, nil).Times(1)
114114

115115
proxy := envoy.NewProxy(envoy.KindSidecar, proxyUUID, identity.New(tests.BookstoreServiceAccountName, tests.Namespace), nil)
116-
mockKubeController.EXPECT().GetPodForProxy(proxy).Return(&pod, nil).Times(1)
116+
mockKubeController.EXPECT().GetPodForProxy(proxy).Return(pod, nil).Times(1)
117117
meshServices, err := proxyRegistry.ListProxyServices(proxy)
118118
Expect(err).ToNot(HaveOccurred())
119119

@@ -150,7 +150,7 @@ var _ = Describe("Test Proxy-Service mapping", func() {
150150
expectedList := []service.MeshService{expected}
151151
mockKubeController.EXPECT().GetEndpoints(gomock.Any()).Return(nil, nil)
152152

153-
mockKubeController.EXPECT().GetPodForProxy(newProxy).Return(&newPod, nil).Times(1)
153+
mockKubeController.EXPECT().GetPodForProxy(newProxy).Return(newPod, nil).Times(1)
154154
// Subdomain gets called in the ListProxyServices
155155
meshServices, err := proxyRegistry.ListProxyServices(newProxy)
156156
Expect(err).ToNot(HaveOccurred())

0 commit comments

Comments
 (0)