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/05/23 14:35:38 UTC

[apisix-dashboard] 02/03: ci: run backend e2e with APISIX 2.6

This is an automated email from the ASF dual-hosted git repository.

chenjunxu pushed a commit to branch release/2.7
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git

commit e05aa2f01dc7d4683d926f035bddaed6b8fef6fe
Author: nic-chen <jo...@163.com>
AuthorDate: Sun May 23 22:33:45 2021 +0800

    ci: run backend e2e with APISIX 2.6
---
 api/test/docker/apisix_config.yaml                         |  7 ++++++-
 api/test/docker/docker-compose.yaml                        | 13 +++++++++++--
 api/test/e2enew/base/base.go                               |  6 ++++++
 api/test/e2enew/route/route_with_plugin_prometheus_test.go |  6 +++---
 4 files changed, 26 insertions(+), 6 deletions(-)

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..e8941c5 100644
--- a/api/test/docker/docker-compose.yaml
+++ b/api/test/docker/docker-compose.yaml
@@ -127,7 +127,11 @@ services:
 
   apisix:
     hostname: apisix_server1
-    image: apache/apisix:2.5-alpine
+    build:
+      context: ../../
+      dockerfile: test/docker/Dockerfile-apisix
+      args:
+        - APISIX_VERSION=master
     restart: always
     volumes:
       - ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
@@ -141,6 +145,7 @@ services:
     ports:
       - '9080:9080/tcp'
       - '9090:9090/tcp'
+      - '9091:9091/tcp'
       - '9443:9443/tcp'
     networks:
       apisix_dashboard_e2e:
@@ -148,7 +153,11 @@ services:
 
   apisix2:
     hostname: apisix_server2
-    image: apache/apisix:2.5-alpine
+    build:
+      context: ../../
+      dockerfile: test/docker/Dockerfile-apisix
+      args:
+        - APISIX_VERSION=master
     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..0906440 100644
--- a/api/test/e2enew/route/route_with_plugin_prometheus_test.go
+++ b/api/test/e2enew/route/route_with_plugin_prometheus_test.go
@@ -60,7 +60,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,7 +102,7 @@ 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,
@@ -110,7 +110,7 @@ var _ = ginkgo.Describe("route with plugin prometheus", func() {
 			Sleep:        base.SleepTime,
 		}),
 		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,