Skip to content

Commit c638814

Browse files
authored
chore: compatible with Apache APISIX 2.6 (#1940)
1 parent ddb76db commit c638814

File tree

5 files changed

+98
-7
lines changed

5 files changed

+98
-7
lines changed

api/conf/schema.json

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,84 @@
27012701
},
27022702
"version": 0.1
27032703
},
2704+
"ext-plugin-post-req": {
2705+
"priority": -3000,
2706+
"schema": {
2707+
"$comment": "this is a mark for our injected plugin schema",
2708+
"properties": {
2709+
"conf": {
2710+
"items": {
2711+
"properties": {
2712+
"name": {
2713+
"maxLength": 128,
2714+
"minLength": 1,
2715+
"type": "string"
2716+
},
2717+
"value": {
2718+
"type": "string"
2719+
}
2720+
},
2721+
"type": "object"
2722+
},
2723+
"minItems": 1,
2724+
"type": "array"
2725+
},
2726+
"disable": {
2727+
"type": "boolean"
2728+
},
2729+
"extra_info": {
2730+
"items": {
2731+
"maxLength": 64,
2732+
"minLength": 1,
2733+
"type": "string"
2734+
},
2735+
"minItems": 1,
2736+
"type": "array"
2737+
}
2738+
},
2739+
"type": "object"
2740+
},
2741+
"version": 0.1
2742+
},
2743+
"ext-plugin-pre-req": {
2744+
"priority": 12000,
2745+
"schema": {
2746+
"$comment": "this is a mark for our injected plugin schema",
2747+
"properties": {
2748+
"conf": {
2749+
"items": {
2750+
"properties": {
2751+
"name": {
2752+
"maxLength": 128,
2753+
"minLength": 1,
2754+
"type": "string"
2755+
},
2756+
"value": {
2757+
"type": "string"
2758+
}
2759+
},
2760+
"type": "object"
2761+
},
2762+
"minItems": 1,
2763+
"type": "array"
2764+
},
2765+
"disable": {
2766+
"type": "boolean"
2767+
},
2768+
"extra_info": {
2769+
"items": {
2770+
"maxLength": 64,
2771+
"minLength": 1,
2772+
"type": "string"
2773+
},
2774+
"minItems": 1,
2775+
"type": "array"
2776+
}
2777+
},
2778+
"type": "object"
2779+
},
2780+
"version": 0.1
2781+
},
27042782
"fault-injection": {
27052783
"priority": 11000,
27062784
"schema": {

api/test/docker/apisix_config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ plugin_attr:
9696
service_name: APISIX
9797
service_instance_name: "APISIX Instance Name"
9898
endpoint_addr: http://172.16.238.50:12800
99-
10099
server-info:
101100
report_interval: 60
102101
report_ttl: 3600
102+
prometheus:
103+
export_uri: /apisix/prometheus/metrics
104+
enable_export_server: true
105+
export_addr:
106+
ip: "0.0.0.0"
107+
port: 9091

api/test/docker/docker-compose.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ services:
127127

128128
apisix:
129129
hostname: apisix_server1
130-
image: apache/apisix:2.5-alpine
130+
image: apache/apisix:2.6-alpine
131131
restart: always
132132
volumes:
133133
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
@@ -141,14 +141,15 @@ services:
141141
ports:
142142
- '9080:9080/tcp'
143143
- '9090:9090/tcp'
144+
- '9091:9091/tcp'
144145
- '9443:9443/tcp'
145146
networks:
146147
apisix_dashboard_e2e:
147148
ipv4_address: 172.16.238.30
148149

149150
apisix2:
150151
hostname: apisix_server2
151-
image: apache/apisix:2.5-alpine
152+
image: apache/apisix:2.6-alpine
152153
restart: always
153154
volumes:
154155
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro

api/test/e2enew/base/base.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var (
4141
APISIXInternalUrl = "http://172.16.238.30:9080"
4242
APISIXSingleWorkerHost = "http://127.0.0.1:9081"
4343
ManagerAPIHost = "http://127.0.0.1:9000"
44+
PrometheusExporter = "http://127.0.0.1:9091"
4445
)
4546

4647
func GetToken() string {
@@ -79,6 +80,11 @@ func APISIXExpect() *httpexpect.Expect {
7980
return httpexpect.New(t, APISIXHost)
8081
}
8182

83+
func PrometheusExporterExpect() *httpexpect.Expect {
84+
t := getTestingHandle()
85+
return httpexpect.New(t, PrometheusExporter)
86+
}
87+
8288
func APISIXHTTPSExpect() *httpexpect.Expect {
8389
t := getTestingHandle()
8490
e := httpexpect.WithConfig(httpexpect.Config{

api/test/e2enew/route/route_with_plugin_prometheus_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package route
1818

1919
import (
2020
"net/http"
21+
"time"
2122

2223
"github.com/onsi/ginkgo"
2324
"github.com/onsi/ginkgo/extensions/table"
@@ -60,7 +61,7 @@ var _ = ginkgo.Describe("route with plugin prometheus", func() {
6061
ExpectStatus: http.StatusOK,
6162
}),
6263
table.Entry("fetch the prometheus metric data", base.HttpTestCase{
63-
Object: base.APISIXExpect(),
64+
Object: base.PrometheusExporterExpect(),
6465
Method: http.MethodGet,
6566
Path: "/apisix/prometheus/metrics",
6667
ExpectStatus: http.StatusOK,
@@ -102,15 +103,15 @@ var _ = ginkgo.Describe("route with plugin prometheus", func() {
102103
Sleep: base.SleepTime,
103104
}),
104105
table.Entry("verify the prometheus metric data (apisix_http_status 200)", base.HttpTestCase{
105-
Object: base.APISIXExpect(),
106+
Object: base.PrometheusExporterExpect(),
106107
Method: http.MethodGet,
107108
Path: "/apisix/prometheus/metrics",
108109
ExpectStatus: http.StatusOK,
109110
ExpectBody: `apisix_http_status{code="200",route="r1",matched_uri="/hello",matched_host="",service="",consumer=""`,
110-
Sleep: base.SleepTime,
111+
Sleep: 1 * time.Second,
111112
}),
112113
table.Entry("verify the prometheus metric data (apisix_http_status 404)", base.HttpTestCase{
113-
Object: base.APISIXExpect(),
114+
Object: base.PrometheusExporterExpect(),
114115
Method: http.MethodGet,
115116
Path: "/apisix/prometheus/metrics",
116117
ExpectStatus: http.StatusOK,

0 commit comments

Comments
 (0)