karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Add local e2e test script

Open B1F030 opened this issue 1 year ago • 5 comments

What would you like to be added: Two optional methods:

  1. Add a section in Makefile like this:
.PHONY: test-integration
test-integration: ...
  1. Add a new script named local-e2e.sh, like run-e2e.sh.

Why is this needed:

  1. Now we only have run-e2e.sh script for github ci, but it will be convenient to have a e2e test script for local environment.
  2. Also, we can reduce the pressure on github ci, because we don't need to commit everytime to trigger e2e test, if we can run test in local environment.
  3. Now after running the run-e2e.sh script, it will generate some logs, and trigger pre-run-e2e.sh & post-run-e2e.sh to create & delete extra components, which is not necessary for local environment(because it's designed for github ci environment). So we need another script for local e2e test.

B1F030 avatar May 30 '24 02:05 B1F030

@zhzhuang-zju

B1F030 avatar May 30 '24 03:05 B1F030

Now we only have run-e2e.sh script for github ci, but it will be convenient to have a e2e test script for local environment.

@B1F030 Can you remind me what difficulties you encountered using run-e2e.sh locally?

zhzhuang-zju avatar May 30 '24 08:05 zhzhuang-zju

@B1F030 Can you remind me what difficulties you encountered using run-e2e.sh locally?

Updated.

B1F030 avatar May 30 '24 09:05 B1F030

Hi @B1F030, we actually has the ability to run e2e locally

First, you should install latest ginkgo:

$ go install github.com/onsi/ginkgo/v2/ginkgo
$ ginkgo version                             
Ginkgo Version 2.17.1

Then, change file directory to you local karmada repo

  • If you want to run individual test case, you can do like this:
$ export KUBECONFIG=~/.kube/karmada.config
$ ginkgo -v --race --trace --fail-fast -p --focus="replicas divided and weighted testing when rescheduling" ./test/e2e/ -- --karmada-context=karmada-apiserver

the value of params --focus should be the text of ginkgo.Describe or ginkgo.Context or ginkgo.It, then it will run the individual e2e case below corresponding part.

  • If you want to run all the test case, you can do like this:
$ export KUBECONFIG=~/.kube/karmada.config                                                                                                                    
$ hack/run-e2e.sh
Image: "docker.io/karmada/karmada-interpreter-webhook-example:latest" with ID "sha256:dc369188d4e3deeef02fc9f323e3992463856ade94dab4da07d04e4dc2b1c08e" not yet present on node "karmada-host-control-plane", loading...
Warning: resource configmaps/kube-proxy is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
configmap/kube-proxy configured
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 64992  100 64992    0     0    99k      0 --:--:-- --:--:-- --:--:--   99k
namespace/metallb-system created
customresourcedefinition.apiextensions.k8s.io/addresspools.metallb.io created
customresourcedefinition.apiextensions.k8s.io/bfdprofiles.metallb.io created
customresourcedefinition.apiextensions.k8s.io/bgpadvertisements.metallb.io created
customresourcedefinition.apiextensions.k8s.io/bgppeers.metallb.io created
customresourcedefinition.apiextensions.k8s.io/communities.metallb.io created
......
Running Suite: E2E Suite - /root/home/gopath/src/github.com/chaosi-zju/karmada/test/e2e
=======================================================================================
Random Seed: 1718075379 - will randomize all specs

Will run 189 of 189 specs
Running in parallel across 4 processes
------------------------------
......

At last, it is more friendly to use first method for it can save more time.

chaosi-zju avatar Jun 11 '24 03:06 chaosi-zju

Hi @B1F030, we actually has the ability to run e2e locally

Thanks! Really appreciate it.

B1F030 avatar Jun 11 '24 06:06 B1F030

/kind support /remove-kind feature /close

feel free to reopen if still have some problem.

liangyuanpeng avatar Aug 02 '24 09:08 liangyuanpeng

@liangyuanpeng: The label(s) kind/support cannot be applied, because the repository doesn't have them.

In response to this:

/kind support /remove-kind feature /close

feel free to reopen if still have some problem.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karmada-bot avatar Aug 02 '24 09:08 karmada-bot

@liangyuanpeng: Closing this issue.

In response to this:

/kind support /remove-kind feature /close

feel free to reopen if still have some problem.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karmada-bot avatar Aug 02 '24 09:08 karmada-bot

/kind question

liangyuanpeng avatar Aug 02 '24 09:08 liangyuanpeng