Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: e2e test #607

Closed
27 of 40 tasks
nic-chen opened this issue Oct 27, 2020 · 7 comments
Closed
27 of 40 tasks

proposal: e2e test #607

nic-chen opened this issue Oct 27, 2020 · 7 comments

Comments

@nic-chen
Copy link
Member

nic-chen commented Oct 27, 2020

Background

Manager api no longer interacts with admin api, but writes data directly to etcd.

At present, we do not have the e2e test cases that cover from dashboard, manager api to Apache APISIX.

Plan

  1. e2e test is divided into two parts, front-end e2e and back-end e2e

  2. Because the front-end only uses part of the interface of manager api, the front-end e2e only needs to ensure normal interaction with manager api

  3. Back-end e2e, APISIX is started through docker, Go calls manager api to configure routing and other resources, then access APISIX for verification.

Details

Development language: Go

Test library: https://github.com/gavv/httpexpect

Test environment: Start with docker-compose, a 3-node ETCD cluster, and 2-node APISIX cluster (2 nodes need to be verified at the same time).

Since APISIX already has complete test cases, we plan to migrate the test cases under the APISIX t directory.

Because of the huge workload, I will first migrate the test cases under t/node/ and t/router/, and leave other use cases to others who have time, or migrate later when I have time to complete the coverage.

Test cases

  1. route
  • host:
    Configure the correct host and hosts through the manager api, including wildcard domain name, and verify the correctness of the route by accessing APISIX.
    Confirm that the manager api cannot configure host and hosts at the same time
    Make sure that the manager api cannot be configured with wrong hosts and hosts, including illegal strings, too high length, wrong data types, etc.

  • invalid conf
    Confirm that the manager api verifies the correctness of each field. include:
    String: length check, regular expression check
    IP: v4 v6 format verification
    int, float, bool and other types check

  • config route with not exist service_id or upstream_id

  • remote_addr, remote_addrs: v4 v6 format verification

  • uri, uris
    invalid value check
    empty value check

  • vars: args, cookie, header, different operators
    check combinations of different types of vars and operators

  • methods
    Wrong data type (not string array)
    Not in enumerated values

  • priority
    Customize different priority checks
    Custom and default priority verification

  • plugins
    Extract at least one plug-in from auth, limit, log, trace, metrics and other types respectively for verification

  • plugin orchestration check (normal and invalid check)

  • other fields: name, desc, create_time, update_time, labels, filter_func(can't verify in Go, TODO)

  • not exist field
    Confirm that the manager api can refuse to configure undefined fields

  • Verify routing correctness under multi routes

  • router engine: check radixtree_uri first, radixtree_host_uri TODO

  1. upstream
  • key: remote_addr, query_string, arg_xxx
  • hash_on: consumer, header, cookie, vars
  • node: ipv6, domain, array nodes (struct)
  • ewma: latency, frequency
  • roundrobin:, weight
  • timeout
  • retries
  • websocket
  • health check: active, passive, healthy, unhealthy
  • invalid conf
  1. ssl
  • cert + key + sni
  • cert + key + snis
  • certs + keys + snis
  • wildcard domain name

4.consumer

  • missing auth plugin
  • two or more auth plugins
  • with plugins
  1. service
  • invalid route
  • route with empty service
  1. global rules
  • add
  • update
  • delete
  • cover by route plugins
  1. plugins merge
  • route + service
  • route + consumer
  • route + service + consumer

The test cases only describe the route part in detail, and the other parts will be detailed in the issue later.

@juzhiyuan juzhiyuan added documentation Improvements or additions to documentation proposal labels Oct 27, 2020
@moonming
Copy link
Member

moonming commented Oct 27, 2020

it will be best if add checkbox for each test case

@membphis membphis pinned this issue Oct 28, 2020
@nic-chen
Copy link
Member Author

it will be best if add checkbox for each test case

OK

@juzhiyuan juzhiyuan added this to the 2.1 milestone Oct 28, 2020
@juzhiyuan
Copy link
Member

Just added this issue to 2.1, feel free to adjust it.

@membphis
Copy link
Member

Is there a small PR as a sample? For example, test the host part of route.

And we can run it in CI, confirm the manager works fine.

BTW, running e2e use cases, can we get the latest code coverage results?
Code coverage is a very important indicator for testing.

@juzhiyuan juzhiyuan mentioned this issue Oct 28, 2020
7 tasks
@nic-chen
Copy link
Member Author

# run APISIX and ETCD 

$ cd api/test/docker && docker-compose up -d

# run test

$ export APIX_ETCD_ENDPOINTS=127.0.0.1:2379,127.0.0.1:3379,127.0.0.1:4379

$ cd ../e2e && go test

@moonming
Copy link
Member

please add tag for those small issues.

@nic-chen
Copy link
Member Author

nic-chen commented Dec 2, 2020

put it to next milestone to continue this job.
will create small issues to add test cases step by step.

@nic-chen nic-chen modified the milestones: 2.1.1, 2.2 Dec 2, 2020
@membphis membphis removed this from the 2.2 milestone Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants