Skip to content

Commit 42b1907

Browse files
committed
removed os.Setenv
1 parent c408b48 commit 42b1907

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

examples/grpc/grpc-unary-client/client/hello_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package client
22

33
import (
44
"context"
5-
"fmt"
6-
"os"
75
"testing"
86

97
"github.com/stretchr/testify/assert"
@@ -148,13 +146,10 @@ func TestGoFrHelloClientWrapper_MultipleInstances(t *testing.T) {
148146
}
149147

150148
func TestGoFrHelloClientWrapper_ErrorHandling(t *testing.T) {
151-
configs := testutil.NewServerConfigs(t)
149+
_ = testutil.NewServerConfigs(t)
152150

153151
// Test GoFr's error handling patterns
154152
t.Run("InvalidAddressHandling", func(t *testing.T) {
155-
// Set HTTP port to avoid port conflicts
156-
os.Setenv("HTTP_PORT", fmt.Sprintf("%d", configs.HTTPPort))
157-
158153
// Test GoFr's handling of invalid addresses
159154
app := gofr.New()
160155
helloClient, err := NewHelloGoFrClient("invalid:address", app.Metrics())

examples/grpc/grpc-unary-client/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestIntegration_UnaryClient(t *testing.T) {
6060
time.Sleep(100 * time.Millisecond)
6161

6262
// Set the gRPC server host for the client
63-
os.Setenv("GRPC_SERVER_HOST", configs.GRPCHost)
63+
t.Setenv("GRPC_SERVER_HOST", configs.GRPCHost)
6464

6565
// Start the HTTP server (unary client example)
6666
go main()
@@ -119,7 +119,7 @@ func TestIntegration_UnaryClient_Concurrent(t *testing.T) {
119119
time.Sleep(100 * time.Millisecond)
120120

121121
// Set the gRPC server host for the client
122-
os.Setenv("GRPC_SERVER_HOST", configs.GRPCHost)
122+
t.Setenv("GRPC_SERVER_HOST", configs.GRPCHost)
123123

124124
// Start the HTTP server (unary client example)
125125
go main()

0 commit comments

Comments
 (0)