Skip to content

docs: remove invalid response body data of test files #6538

Description

@Chever-John

Improved or typo fixed.

In the test file, there is a lot of redundant request response body data, and some just duplicate the input content. For this reason, a PR is needed to improve the test example situation.

For example, this following section of the test file fits the above description, and all you need to do is remove the following section.

=== TEST 5: set route(id: 1) to etcd cluster with TLS
--- yaml_config
apisix:
  node_listen: 1984
  admin_key: null
etcd:
  host:
    - "https://127.0.0.1:12379"
  tls:
    verify: false
--- config
    location /t {
        content_by_lua_block {
            local t = require("lib.test_admin").test
            local code, body = t('/apisix/admin/routes/1',
                ngx.HTTP_PUT,
                [[{
                    "methods": ["GET"],
                    "upstream": {
                        "nodes": {
                            "127.0.0.1:8080": 1
                        },
                        "type": "roundrobin"
                    },
                    "desc": "new route",
                    "uri": "/index.html"
                }]],
                # The response body below is what needs to be deleted
                [[{
                    "node": {
                        "value": {
                            "methods": [
                                "GET"
                            ],
                            "uri": "/index.html",
                            "desc": "new route",
                            "upstream": {
                                "nodes": {
                                    "127.0.0.1:8080": 1
                                },
                                "type": "roundrobin"
                            }
                        },
                        "key": "/apisix/routes/1"
                    },
                    "action": "set"
                }]]
                )

            ngx.status = code
            ngx.say(body)
        }
    }
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]

Solution

You can solve this problem by writing scripts in languages that include but are not limited to Python.

The logic of a scripting language can be as follows:

  1. Determine the scope of the script;
  2. Identifying marker(need to find out by yourself);
  3. Delete the associated row.

Your suggestions and more efficient solutions are welcome!

Metadata

Metadata

Assignees

Labels

docDocumentation things

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions