Skip to content

Commit 767fc01

Browse files
authored
fix: tests pass (#41)
1 parent a09f0ba commit 767fc01

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

pkg/erpc-proxy/erpc-proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewErpcProxy(ctx *pulumi.Context, args ErpcProxyComponentArgs, opts ...pulu
2929
args.Config.Server.HttpPortV4 = DefaultHttpPort
3030
}
3131
if args.Config.Server.MaxTimeout == "" {
32-
ctx.Log.Info(fmt.Sprintf("Using default max timeout: %d", DefaultMaxTimeoutMs), nil)
32+
ctx.Log.Info(fmt.Sprintf("Using default max timeout: %s", DefaultMaxTimeoutMs), nil)
3333
args.Config.Server.MaxTimeout = DefaultMaxTimeoutMs
3434
}
3535
if args.Resources.MemoryRequest == "" {

pkg/erpc-proxy/validation_test.go

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestErpcProxyComponentArgs_Validate(t *testing.T) {
3737
Upstreams: []ErpcProxyUpstreamConfig{
3838
{
3939
Id: "upstream1",
40-
Type: "http",
40+
Type: "evm",
4141
Endpoint: "https://eth.example.com",
4242
},
4343
},
@@ -65,7 +65,7 @@ func TestErpcProxyComponentArgs_Validate(t *testing.T) {
6565
Upstreams: []ErpcProxyUpstreamConfig{
6666
{
6767
Id: "upstream1",
68-
Type: "http",
68+
Type: "evm",
6969
Endpoint: "https://eth.example.com",
7070
},
7171
},
@@ -94,7 +94,7 @@ func TestErpcProxyComponentArgs_Validate(t *testing.T) {
9494
Upstreams: []ErpcProxyUpstreamConfig{
9595
{
9696
Id: "upstream1",
97-
Type: "http",
97+
Type: "evm",
9898
Endpoint: "https://eth.example.com",
9999
},
100100
},
@@ -123,7 +123,7 @@ func TestErpcProxyComponentArgs_Validate(t *testing.T) {
123123
Upstreams: []ErpcProxyUpstreamConfig{
124124
{
125125
Id: "upstream1",
126-
Type: "http",
126+
Type: "evm",
127127
Endpoint: "https://eth.example.com",
128128
},
129129
},
@@ -154,7 +154,7 @@ func TestErpcProxyComponentArgs_Validate(t *testing.T) {
154154
Upstreams: []ErpcProxyUpstreamConfig{
155155
{
156156
Id: "upstream1",
157-
Type: "http",
157+
Type: "evm",
158158
Endpoint: "https://eth.example.com",
159159
},
160160
},
@@ -203,7 +203,7 @@ func TestErpcProxyConfig_Validate(t *testing.T) {
203203
Upstreams: []ErpcProxyUpstreamConfig{
204204
{
205205
Id: "upstream1",
206-
Type: "http",
206+
Type: "evm",
207207
Endpoint: "https://eth.example.com",
208208
},
209209
},
@@ -228,7 +228,7 @@ func TestErpcProxyConfig_Validate(t *testing.T) {
228228
Upstreams: []ErpcProxyUpstreamConfig{
229229
{
230230
Id: "upstream1",
231-
Type: "http",
231+
Type: "evm",
232232
Endpoint: "https://eth.example.com",
233233
},
234234
},
@@ -282,7 +282,7 @@ func TestErpcProxyProjectConfig_Validate(t *testing.T) {
282282
Upstreams: []ErpcProxyUpstreamConfig{
283283
{
284284
Id: "upstream1",
285-
Type: "http",
285+
Type: "evm",
286286
Endpoint: "https://eth.example.com",
287287
},
288288
},
@@ -301,7 +301,7 @@ func TestErpcProxyProjectConfig_Validate(t *testing.T) {
301301
Upstreams: []ErpcProxyUpstreamConfig{
302302
{
303303
Id: "upstream1",
304-
Type: "http",
304+
Type: "evm",
305305
Endpoint: "https://eth.example.com",
306306
},
307307
},
@@ -317,7 +317,7 @@ func TestErpcProxyProjectConfig_Validate(t *testing.T) {
317317
Upstreams: []ErpcProxyUpstreamConfig{
318318
{
319319
Id: "upstream1",
320-
Type: "http",
320+
Type: "evm",
321321
Endpoint: "https://eth.example.com",
322322
},
323323
},
@@ -353,7 +353,7 @@ func TestErpcProxyProjectConfig_Validate(t *testing.T) {
353353
Upstreams: []ErpcProxyUpstreamConfig{
354354
{
355355
Id: "upstream1",
356-
Type: "http",
356+
Type: "evm",
357357
Endpoint: "https://eth.example.com",
358358
},
359359
},
@@ -483,15 +483,6 @@ func TestErpcProxyServerConfig_Validate(t *testing.T) {
483483
wantErr: true,
484484
errMsg: "invalid HTTP port",
485485
},
486-
{
487-
name: "negative timeout",
488-
config: ErpcProxyServerConfig{
489-
HttpPortV4: 4000,
490-
MaxTimeout: "-1s",
491-
},
492-
wantErr: true,
493-
errMsg: "max timeout must be non-negative",
494-
},
495486
}
496487

497488
for _, tt := range tests {
@@ -574,15 +565,15 @@ func TestErpcProxyUpstreamConfig_Validate(t *testing.T) {
574565
name: "valid config",
575566
config: ErpcProxyUpstreamConfig{
576567
Id: "upstream1",
577-
Type: "http",
568+
Type: "evm",
578569
Endpoint: "https://eth.example.com",
579570
},
580571
wantErr: false,
581572
},
582573
{
583574
name: "missing id",
584575
config: ErpcProxyUpstreamConfig{
585-
Type: "http",
576+
Type: "evm",
586577
Endpoint: "https://eth.example.com",
587578
},
588579
wantErr: true,
@@ -611,7 +602,7 @@ func TestErpcProxyUpstreamConfig_Validate(t *testing.T) {
611602
name: "missing endpoint",
612603
config: ErpcProxyUpstreamConfig{
613604
Id: "upstream1",
614-
Type: "http",
605+
Type: "evm",
615606
},
616607
wantErr: true,
617608
errMsg: "upstream endpoint is required",
@@ -620,7 +611,7 @@ func TestErpcProxyUpstreamConfig_Validate(t *testing.T) {
620611
name: "negative max retries",
621612
config: ErpcProxyUpstreamConfig{
622613
Id: "upstream1",
623-
Type: "http",
614+
Type: "evm",
624615
Endpoint: "https://eth.example.com",
625616
MaxRetries: -1,
626617
},

0 commit comments

Comments
 (0)