Skip to content

Commit b1d0a6c

Browse files
committed
merge v3
2 parents 1ecfcad + 190c4dd commit b1d0a6c

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ require (
308308
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 // indirect
309309
go.opentelemetry.io/otel/sdk/metric v1.32.0
310310
golang.org/x/crypto v0.31.0 // indirect
311-
golang.org/x/net v0.31.0 // indirect
311+
golang.org/x/net v0.33.0 // indirect
312312
golang.org/x/sys v0.28.0 // indirect
313313
golang.org/x/text v0.21.0 // indirect
314314
google.golang.org/grpc v1.68.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY
831831
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
832832
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
833833
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
834-
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
835-
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
834+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
835+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
836836
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
837837
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
838838
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=

internal/resource/resource_plugin_test.go

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,51 @@ func TestResource_Process_APIAction_GetStreamUpstreams(t *testing.T) {
589589
topic: []string{bus.DataPlaneResponseTopic},
590590
instance: protos.GetNginxPlusInstance([]string{}),
591591
},
592+
{
593+
name: "Test 3: Fail, No Instance",
594+
message: &bus.Message{
595+
Topic: bus.APIActionRequestTopic,
596+
Data: protos.CreatAPIActionRequestNginxPlusGetHTTPServers("test_upstream",
597+
protos.GetNginxOssInstance([]string{}).GetInstanceMeta().GetInstanceId()),
598+
},
599+
err: errors.New("failed to preform API action, could not find instance with ID: " +
600+
"e1374cb1-462d-3b6c-9f3b-f28332b5f10c"),
601+
upstreams: &client.StreamUpstreams{
602+
"upstream_1": client.StreamUpstream{
603+
Zone: "zone_1",
604+
Peers: []client.StreamPeer{
605+
{
606+
Server: "server_1",
607+
},
608+
},
609+
Zombies: 0,
610+
},
611+
},
612+
topic: []string{bus.DataPlaneResponseTopic},
613+
instance: inValidInstance,
614+
},
615+
{
616+
name: "Test 4: Fail, OSS Instance",
617+
message: &bus.Message{
618+
Topic: bus.APIActionRequestTopic,
619+
Data: protos.CreatAPIActionRequestNginxPlusGetHTTPServers("test_upstream",
620+
protos.GetNginxOssInstance([]string{}).GetInstanceMeta().GetInstanceId()),
621+
},
622+
err: errors.New("failed to preform API action, instance is not NGINX Plus"),
623+
upstreams: &client.StreamUpstreams{
624+
"upstream_1": client.StreamUpstream{
625+
Zone: "zone_1",
626+
Peers: []client.StreamPeer{
627+
{
628+
Server: "server_1",
629+
},
630+
},
631+
Zombies: 0,
632+
},
633+
},
634+
topic: []string{bus.DataPlaneResponseTopic},
635+
instance: protos.GetNginxOssInstance([]string{}),
636+
},
592637
}
593638

594639
for _, test := range tests {
@@ -690,6 +735,55 @@ func TestResource_Process_APIAction_GetUpstreams(t *testing.T) {
690735
topic: []string{bus.DataPlaneResponseTopic},
691736
instance: protos.GetNginxPlusInstance([]string{}),
692737
},
738+
{
739+
name: "Test 3: Fail, No Instance",
740+
message: &bus.Message{
741+
Topic: bus.APIActionRequestTopic,
742+
Data: protos.CreatAPIActionRequestNginxPlusGetHTTPServers("test_upstream",
743+
protos.GetNginxOssInstance([]string{}).GetInstanceMeta().GetInstanceId()),
744+
},
745+
err: errors.New("failed to preform API action, could not find instance with ID: " +
746+
"e1374cb1-462d-3b6c-9f3b-f28332b5f10c"),
747+
upstreams: &client.Upstreams{
748+
"upstream_1": client.Upstream{
749+
Zone: "zone_1",
750+
Peers: []client.Peer{
751+
{
752+
Server: "server_1",
753+
},
754+
},
755+
Queue: client.Queue{},
756+
Keepalive: 6,
757+
Zombies: 0,
758+
},
759+
},
760+
topic: []string{bus.DataPlaneResponseTopic},
761+
instance: inValidInstance,
762+
},
763+
{
764+
name: "Test 4: Fail, OSS Instance",
765+
message: &bus.Message{
766+
Topic: bus.APIActionRequestTopic,
767+
Data: protos.CreatAPIActionRequestNginxPlusGetHTTPServers("test_upstream",
768+
protos.GetNginxOssInstance([]string{}).GetInstanceMeta().GetInstanceId()),
769+
},
770+
err: errors.New("failed to preform API action, instance is not NGINX Plus"),
771+
upstreams: &client.Upstreams{
772+
"upstream_1": client.Upstream{
773+
Zone: "zone_1",
774+
Peers: []client.Peer{
775+
{
776+
Server: "server_1",
777+
},
778+
},
779+
Queue: client.Queue{},
780+
Keepalive: 6,
781+
Zombies: 0,
782+
},
783+
},
784+
topic: []string{bus.DataPlaneResponseTopic},
785+
instance: protos.GetNginxOssInstance([]string{}),
786+
},
693787
}
694788

695789
for _, test := range tests {

0 commit comments

Comments
 (0)