You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ch...@apache.org on 2021/06/12 01:52:15 UTC
[apisix-dashboard] branch master updated: chore: compatible with
Apache APISIX 2.6 (#1940)
This is an automated email from the ASF dual-hosted git repository.
chenjunxu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new c638814 chore: compatible with Apache APISIX 2.6 (#1940)
c638814 is described below
commit c6388140bcf587cf9effc85a0c2dccef1b4b2e7e
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Sat Jun 12 09:52:09 2021 +0800
chore: compatible with Apache APISIX 2.6 (#1940)
---
api/conf/schema.json | 78 ++++++++++++++++++++++
api/test/docker/apisix_config.yaml | 7 +-
api/test/docker/docker-compose.yaml | 5 +-
api/test/e2enew/base/base.go | 6 ++
.../route/route_with_plugin_prometheus_test.go | 9 +--
5 files changed, 98 insertions(+), 7 deletions(-)
diff --git a/api/conf/schema.json b/api/conf/schema.json
index 9fbd996..e40ce79 100644
--- a/api/conf/schema.json
+++ b/api/conf/schema.json
@@ -2701,6 +2701,84 @@
},
"version": 0.1
},
+ "ext-plugin-post-req": {
+ "priority": -3000,
+ "schema": {
+ "$comment": "this is a mark for our injected plugin schema",
+ "properties": {
+ "conf": {
+ "items": {
+ "properties": {
+ "name": {
+ "maxLength": 128,
+ "minLength": 1,
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "minItems": 1,
+ "type": "array"
+ },
+ "disable": {
+ "type": "boolean"
+ },
+ "extra_info": {
+ "items": {
+ "maxLength": 64,
+ "minLength": 1,
+ "type": "string"
+ },
+ "minItems": 1,
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "version": 0.1
+ },
+ "ext-plugin-pre-req": {
+ "priority": 12000,
+ "schema": {
+ "$comment": "this is a mark for our injected plugin schema",
+ "properties": {
+ "conf": {
+ "items": {
+ "properties": {
+ "name": {
+ "maxLength": 128,
+ "minLength": 1,
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "minItems": 1,
+ "type": "array"
+ },
+ "disable": {
+ "type": "boolean"
+ },
+ "extra_info": {
+ "items": {
+ "maxLength": 64,
+ "minLength": 1,
+ "type": "string"
+ },
+ "minItems": 1,
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "version": 0.1
+ },
"fault-injection": {
"priority": 11000,
"schema": {
diff --git a/api/test/docker/apisix_config.yaml b/api/test/docker/apisix_config.yaml
index e56a74d..ab26eaf 100644
--- a/api/test/docker/apisix_config.yaml
+++ b/api/test/docker/apisix_config.yaml
@@ -96,7 +96,12 @@ plugin_attr:
service_name: APISIX
service_instance_name: "APISIX Instance Name"
endpoint_addr: http://172.16.238.50:12800
-
server-info:
report_interval: 60
report_ttl: 3600
+ prometheus:
+ export_uri: /apisix/prometheus/metrics
+ enable_export_server: true
+ export_addr:
+ ip: "0.0.0.0"
+ port: 9091
diff --git a/api/test/docker/docker-compose.yaml b/api/test/docker/docker-compose.yaml
index 2da0990..de1545b 100644
--- a/api/test/docker/docker-compose.yaml
+++ b/api/test/docker/docker-compose.yaml
@@ -127,7 +127,7 @@ services:
apisix:
hostname: apisix_server1
- image: apache/apisix:2.5-alpine
+ image: apache/apisix:2.6-alpine
restart: always
volumes:
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
@@ -141,6 +141,7 @@ services:
ports:
- '9080:9080/tcp'
- '9090:9090/tcp'
+ - '9091:9091/tcp'
- '9443:9443/tcp'
networks:
apisix_dashboard_e2e:
@@ -148,7 +149,7 @@ services:
apisix2:
hostname: apisix_server2
- image: apache/apisix:2.5-alpine
+ image: apache/apisix:2.6-alpine
restart: always
volumes:
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro
diff --git a/api/test/e2enew/base/base.go b/api/test/e2enew/base/base.go
index 60fbcaa..32253ff 100644
--- a/api/test/e2enew/base/base.go
+++ b/api/test/e2enew/base/base.go
@@ -41,6 +41,7 @@ var (
APISIXInternalUrl = "http://172.16.238.30:9080"
APISIXSingleWorkerHost = "http://127.0.0.1:9081"
ManagerAPIHost = "http://127.0.0.1:9000"
+ PrometheusExporter = "http://127.0.0.1:9091"
)
func GetToken() string {
@@ -79,6 +80,11 @@ func APISIXExpect() *httpexpect.Expect {
return httpexpect.New(t, APISIXHost)
}
+func PrometheusExporterExpect() *httpexpect.Expect {
+ t := getTestingHandle()
+ return httpexpect.New(t, PrometheusExporter)
+}
+
func APISIXHTTPSExpect() *httpexpect.Expect {
t := getTestingHandle()
e := httpexpect.WithConfig(httpexpect.Config{
diff --git a/api/test/e2enew/route/route_with_plugin_prometheus_test.go b/api/test/e2enew/route/route_with_plugin_prometheus_test.go
index 2fda5c4..3e8ab15 100644
--- a/api/test/e2enew/route/route_with_plugin_prometheus_test.go
+++ b/api/test/e2enew/route/route_with_plugin_prometheus_test.go
@@ -18,6 +18,7 @@ package route
import (
"net/http"
+ "time"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/extensions/table"
@@ -60,7 +61,7 @@ var _ = ginkgo.Describe("route with plugin prometheus", func() {
ExpectStatus: http.StatusOK,
}),
table.Entry("fetch the prometheus metric data", base.HttpTestCase{
- Object: base.APISIXExpect(),
+ Object: base.PrometheusExporterExpect(),
Method: http.MethodGet,
Path: "/apisix/prometheus/metrics",
ExpectStatus: http.StatusOK,
@@ -102,15 +103,15 @@ var _ = ginkgo.Describe("route with plugin prometheus", func() {
Sleep: base.SleepTime,
}),
table.Entry("verify the prometheus metric data (apisix_http_status 200)", base.HttpTestCase{
- Object: base.APISIXExpect(),
+ Object: base.PrometheusExporterExpect(),
Method: http.MethodGet,
Path: "/apisix/prometheus/metrics",
ExpectStatus: http.StatusOK,
ExpectBody: `apisix_http_status{code="200",route="r1",matched_uri="/hello",matched_host="",service="",consumer=""`,
- Sleep: base.SleepTime,
+ Sleep: 1 * time.Second,
}),
table.Entry("verify the prometheus metric data (apisix_http_status 404)", base.HttpTestCase{
- Object: base.APISIXExpect(),
+ Object: base.PrometheusExporterExpect(),
Method: http.MethodGet,
Path: "/apisix/prometheus/metrics",
ExpectStatus: http.StatusOK,