apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
972 stars 337 forks source link

Add e2e test cases for plugins #321

Open tokers opened 3 years ago

tokers commented 3 years ago

Issue description

We don't cover plugins in e2e test suites, although we support them already. Here I want to initiate a plan to add test cases for most of all plugins in Apache APISIX.

If you're interested in writing some test cases for several plugins, please writing comments like:

I'd like to write e2e test cases for plugin "fault-injection".

Then, I'll create a dedicated issue and assign it to you. After the PR is merged, the checkbox in this description will be clicked.

Test case samples are here:

You may have to learn some usages about ginkgo.

A test case should be a complete e2e case, it contains the configuration create/update/delete on "control plane" (in our case is applying k8s resources like ApisixRoute, ApisixUpstream to Kubernetes), then waiting for it to be effective, and sending requests to "data plane" (APISIX), asserting the response is valid.

When you want to run these cases on your local environment, be sure a Kubernetes cluster is installed, you can create a kubernetes cluster with minikube or kind.

You may try to push images in advance or your cases might be timed out when first run. Related images are:

You can change the Describe or It block in your case to FDescribe or FIt so only these cases will be run when you executing make e2e-test directive. By default make e2e-test will build apisix-ingress-controller from scratch, you can add E2E_SKIP_BUILD=1 to skip this step, and using E2E_CONCURRENCY to control the concurrency of cases.

gxthrj commented 3 years ago

Great Job ~

gxthrj commented 3 years ago

Great Job ~

Firstsawyou commented 3 years ago

I'd like to write e2e test cases for plugin "key-auth".

juzhiyuan commented 3 years ago

I'd like to write e2e test cases for plugin "key-auth".

any update?

Firstsawyou commented 3 years ago

I'd like to write e2e test cases for plugin "key-auth".

any update?

Currently, there is no configuration that supports the consumer object. I need to wait for the consumer configuration to be supported before submitting this test.

Firstsawyou commented 3 years ago

I'd like to write e2e test cases for plugin "referer-restriction".

fhuzero commented 3 years ago

I'd like to write e2e test cases for plugin "server-info".

fhuzero commented 3 years ago

Help needed: is there any way to run test cases for just one plugin? I want to run test cases I wrote for plugin "server-info". Modifying ginkgo command under PHONY e2e-test in Makefile seems to have no effect, ginkgo still runs all test cases.

tokers commented 3 years ago

Help needed: is there any way to run test cases for just one plugin? I want to run test cases I wrote for plugin "server-info". Modifying ginkgo command under PHONY e2e-test in Makefile seems to have no effect, ginkgo still runs all test cases.

Yep, please read the issue description.

fhuzero commented 3 years ago

Thanks for your reply!

Help needed: is there any way to run test cases for just one plugin? I want to run test cases I wrote for plugin "server-info". Modifying ginkgo command under PHONY e2e-test in Makefile seems to have no effect, ginkgo still runs all test cases.

Yep, please read the issue description.

Thanks! It's done by changing Describe to FDescribe. Sorry for not examining the issue description carefully. Just went through a hard time configuring the environment.

tokers commented 3 years ago

Thanks for your reply!

Help needed: is there any way to run test cases for just one plugin? I want to run test cases I wrote for plugin "server-info". Modifying ginkgo command under PHONY e2e-test in Makefile seems to have no effect, ginkgo still runs all test cases.

Yep, please read the issue description.

Thanks! It's done by changing Describe to FDescribe. Sorry for not examining the issue description carefully. Just went through a hard time configuring the environment.

Feel free to ask any questions here.

fhuzero commented 3 years ago

Now I have a workable version for "server-info" test cases. But as for implementation details and how the test is done I would like to raise some questions for discussion. Shall we create a dedicated issue for "server-info" plugin test cases or I just start a PR so we can discuss in that PR?

tokers commented 3 years ago

Now I have a workable version for "server-info" test cases. But as for implementation details and how the test is done I would like to

raise some questions for discussion. Shall we create a dedicated issue for "server-info" plugin test cases or I just start a PR so we can discuss in that PR?

I think so, you can go ahead and create it.

tokers commented 3 years ago

Now I have a workable version for "server-info" test cases. But as for implementation details and how the test is done I would like to raise some questions for discussion. Shall we create a dedicated issue for "server-info" plugin test cases or I just start a PR so we can discuss in that PR?

Merged #406 , thanks!

Belyenochi commented 2 years ago

I'd like to write e2e test cases for plugin "prometheus"

tao12345666333 commented 2 years ago

@Belyenochi Thanks! We currently have it covered. But in the latest APISIX the Prometheus plugin needs to be exposed using the public-api plugin, it would be great if you could modify this part.

Belyenochi commented 2 years ago

@Belyenochi Thanks! We currently have it covered. But in the latest APISIX the Prometheus plugin needs to be exposed using the public-api plugin, it would be great if you could modify this part.

OK, I'm willing to help and I'll check the documentation of the public-api plugin.

tao12345666333 commented 2 years ago

@Belyenochi Thanks! We currently have it covered. But in the latest APISIX the Prometheus plugin needs to be exposed using the public-api plugin, it would be great if you could modify this part.

OK, I'm willing to help and I'll check the documentation of the public-api plugin.

FYI https://github.com/apache/apisix/issues/6276#issuecomment-1034431045

Belyenochi commented 2 years ago

@Belyenochi Thanks! We currently have it covered. But in the latest APISIX the Prometheus plugin needs to be exposed using the public-api plugin, it would be great if you could modify this part.

OK, I'm willing to help and I'll check the documentation of the public-api plugin.

FYI apache/apisix#6276 (comment)

hi @tao12345666333, on which branch should I find the currently code for prometheus e2e tests?

tao12345666333 commented 2 years ago

@Belyenochi you can just use master branch

tao12345666333 commented 2 years ago

Kind reminder, is there anything I can help you @Belyenochi

Chever-John commented 2 years ago

Hi, I want to continue this issues about adding test cases for prometheus plug-in. If you(@Belyenochi ) are still in this issues or finish it a while, please tell me in time. I plan to finish it next week. @tao12345666333

tao12345666333 commented 2 years ago

Hi, I want to continue this issues about adding test cases for prometheus plug-in.

If you(@Belyenochi ) are still in this issues or finish it a while, please tell me in time.

I plan to finish this next week. @tao12345666333

👌 thanks

Belyenochi commented 2 years ago

Hi, I want to continue this issues about adding test cases for prometheus plug-in. If you(@Belyenochi ) are still in this issues or finish it a while, please tell me in time. I plan to finish it next week. @tao12345666333

Thanks, please continue, sorry for not updating the status in time.

tao12345666333 commented 2 years ago

@Belyenochi Don't worry, thanks for your continued contributions

github-actions[bot] commented 1 year ago

This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.