From 53afed56f2f3001207bf58cc8f029d9b456c439a Mon Sep 17 00:00:00 2001 From: sshniro Date: Wed, 29 Jul 2020 10:13:19 +0200 Subject: [PATCH] doc improvements for OSx unit tests --- doc/how-to-build.md | 14 ++++++-- doc/plugins/request-validation.md | 60 ++++++++++++++++--------------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/doc/how-to-build.md b/doc/how-to-build.md index 157baa324007..ba213ba18a5e 100644 --- a/doc/how-to-build.md +++ b/doc/how-to-build.md @@ -115,12 +115,20 @@ Makefile rules: * Run the test cases: `make test` * To set the path of nginx to run the test cases: `TEST_NGINX_BINARY=/usr/local/bin/openresty prove -Itest-nginx/lib -r t` -### Troubleshoot +### Troubleshoot Testing -If you run in to an issue `Error unknown directive "lua_package_path" in /API_ASPIX/incubator-apisix/t/servroot/conf/nginx.conf` +**Set Nginx Path** +- If you run in to an issue `Error unknown directive "lua_package_path" in /API_ASPIX/incubator-apisix/t/servroot/conf/nginx.conf` make sure to set openresty as default nginx. And export the path as below. - * export PATH=/usr/local/openresty/nginx/sbin:$PATH + - Linux default installation path: + * export PATH=/usr/local/openresty/nginx/sbin:$PATH + - OSx default installation path via homebrew: + * export PATH=/usr/local/opt/openresty/nginx/sbin:$PATH + +**Run Individual Test Cases** +- Use the following command to run test cases constratined to a file: + - prove -Itest-nginx/lib -r t/plugin/openid-connect.t ## 5. Update Admin API token to protect Apache APISIX diff --git a/doc/plugins/request-validation.md b/doc/plugins/request-validation.md index fd2322756b21..7c29e873d85f 100644 --- a/doc/plugins/request-validation.md +++ b/doc/plugins/request-validation.md @@ -107,15 +107,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13 **Using ENUMS:** -```shell -"body_schema": { - "type": "object", - "required": ["required_payload"], - "properties": { - "emum_payload": { - "type": "string", - enum: ["enum_string_1", "enum_string_2"] - default = "enum_string_1" +```json +{ + "body_schema": { + "type": "object", + "required": ["required_payload"], + "properties": { + "emum_payload": { + "type": "string", + "enum": ["enum_string_1", "enum_string_2"], + "default": "enum_string_1" + } } } } @@ -124,25 +126,27 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13 **JSON with multiple levels:** -```shell -"body_schema": { - "type": "object", - "required": ["required_payload"], - "properties": { - "boolean_payload": {"type": "boolean"}, - "child_element_name": { - "type": "object", - "properties": { - "http_statuses": { - "type": "array", - "minItems": 1, - "items": { - "type": "integer", - "minimum": 200, - "maximum": 599 - }, - "uniqueItems": true, - "default": [200, 201, 202, 203] +```json +{ + "body_schema": { + "type": "object", + "required": ["required_payload"], + "properties": { + "boolean_payload": {"type": "boolean"}, + "child_element_name": { + "type": "object", + "properties": { + "http_statuses": { + "type": "array", + "minItems": 1, + "items": { + "type": "integer", + "minimum": 200, + "maximum": 599 + }, + "uniqueItems": true, + "default": [200, 201, 202, 203] + } } } }