Skip to content

Commit ea66ccd

Browse files
committed
fix: failing tests after switch to grpc.NewClient
1 parent cf48f41 commit ea66ccd

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

pkg/provider/grpc/grpc_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"google.golang.org/grpc"
1111
"google.golang.org/grpc/health"
1212
"google.golang.org/grpc/health/grpc_health_v1"
13+
"google.golang.org/grpc/resolver"
1314

1415
ph "github.com/isometry/platform-health/pkg/platform_health"
1516
provider_grpc "github.com/isometry/platform-health/pkg/provider/grpc"
@@ -20,6 +21,9 @@ func init() {
2021
}
2122

2223
func TestGetHealth(t *testing.T) {
24+
// workaround for grpc resolver with Zscaler
25+
resolver.SetDefaultScheme("passthrough")
26+
2327
listener, err := net.Listen("tcp", "localhost:0")
2428
if err != nil {
2529
t.Fatalf("Failed to set up test server: %v", err)

pkg/provider/satellite/satellite.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func (i *Satellite) GetHealth(ctx context.Context) *ph.HealthCheckResponse {
9191
if err != nil {
9292
return component.Unhealthy(err.Error())
9393
}
94+
defer conn.Close()
9495

9596
// Propagate already visited serverIds from context to enable loop detection
9697
request := &ph.HealthCheckRequest{

pkg/provider/satellite/satellite_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"time"
99

1010
"github.com/stretchr/testify/assert"
11+
"google.golang.org/grpc/resolver"
1112

1213
ph "github.com/isometry/platform-health/pkg/platform_health"
1314
"github.com/isometry/platform-health/pkg/provider"
@@ -27,6 +28,9 @@ func (c *testConfig) GetInstances() []provider.Instance {
2728
}
2829

2930
func TestSatelliteGetHealth(t *testing.T) {
31+
// workaround for grpc resolver with Zscaler
32+
resolver.SetDefaultScheme("passthrough")
33+
3034
// Start listener for the main server
3135
listener, err := net.Listen("tcp", "localhost:0")
3236
if err != nil {

0 commit comments

Comments
 (0)