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

Add e2e test cases of managing etcd cluster #19

Open
ahrtr opened this issue Jan 6, 2025 · 13 comments
Open

Add e2e test cases of managing etcd cluster #19

ahrtr opened this issue Jan 6, 2025 · 13 comments
Assignees
Labels
help wanted Extra attention is needed test
Milestone

Comments

@ahrtr
Copy link
Member

ahrtr commented Jan 6, 2025

We need to add e2e test cases to verify the etcd-operator's functionalities of managing etcd clusters:

  • create & delete 1 member etcd cluster
  • create & delete 3 member etcd cluster
  • scale in & out etcd cluster
  • sanity test against the etcd cluster
    • read & write k/v
    • member list
    • health check

Kubebuilder automatically generates e2e test using ginkgo, but personally I am not a big fan of ginkgo. It creates some syntax sugars on top of golang standard test, and organize the test in a hierarchical structure. When the test file gets bigger and bigger, it will become more and more unreadable.

So it would be great if we can add the e2e test case just using the golang standard test utilities.

@ahrtr ahrtr added the test label Jan 6, 2025
@ahrtr ahrtr added the help wanted Extra attention is needed label Jan 6, 2025
@abdurrehman107
Copy link

I can take this up guys.

@ahrtr
Copy link
Member Author

ahrtr commented Jan 11, 2025

The #17 has been merged. This task isn't blocked anymore.

@abdurrehman107
Copy link

Sounds good. I'll get started on this today.

@ahrtr ahrtr added this to the v0.1.0 milestone Jan 13, 2025
@ahrtr
Copy link
Member Author

ahrtr commented Jan 14, 2025

Note, essentially, the e2e test automates the manual human test process, ensuring comprehensive coverage and repeatability. For each e2e test cases, we should be able to manually run/reproduce it as well.

@abdurrehman107
Copy link

abdurrehman107 commented Jan 19, 2025

Hey there @ahrtr, I've made a rough scaffold of how the tests are going to look like. It is still in my working branch, I'd really appreciate if you can take a look and give feedback. Here's the link to the fork

The current pushed code is able to:

  1. build a Kind cluster,
  2. deploy the controller to the cluster,
  3. deploy the etcd cluster crd and resource to the cluster,
  4. scale the etcd cluster from 1 to 3

I am getting started with the sanity testing you mentioned. I'd really appreciate feedback.

@ahrtr
Copy link
Member Author

ahrtr commented Jan 20, 2025

@abdurrehman107 Please raise a PR to get feedback, thx

@ahrtr
Copy link
Member Author

ahrtr commented Jan 20, 2025

Also please let's do it step by step.

  • Step 1: let's just rewrite the existing e2e test;
  • Step 2: add more tests

@abdurrehman107
Copy link

Aighty I'll raise a PR. @ahrtr can you elaborate on what you mean by rewriting the existing e2e test? Do you mean that I should rewrite the tests in Ginkgo (by default) to e2e framework?

@ahrtr
Copy link
Member Author

ahrtr commented Jan 20, 2025

Do you mean that I should rewrite the tests in Ginkgo (by default) to e2e framework?

Basically YES. I see that you add the new e2e test using the e2e framework, so there is no reason to keep the existing e2e test with ginkgo.

Actually we have three options,

  • Keep using ginkgo, and add any new e2e test using ginkgo as well. Personally I am not a big fan of ginkgo.
  • rewriting the existing e2e test with e2e framework, afterwards, add all new e2e test using e2e framework as well.
  • rewriting the existing e2e test with golang standard test lib, and afterwards, add all new e2e test using golang standard test lib as well.

@hakman @justinsb @jmhbnz @jberkus what's your thought? thx

@abdurrehman107
Copy link

Quick question @ahrtr how can we exactly do the sanity test against the etcd cluster resource? Do we hit the endpoint for the sts pod and expect a response?

@ahrtr
Copy link
Member Author

ahrtr commented Jan 21, 2025

Do we hit the endpoint for the sts pod and expect a response?

Yes, you can connect to endpoints something like example-etcdcluster-0.example-etcdcluster.default.svc.cluster.local:2379

return name, fmt.Sprintf("http://%s-%d.%s.%s.svc.cluster.local:2380",

@abdurrehman107
Copy link

@ahrtr: just meaning to confirm we want to rewrite the set of default tests, created by Kubebuilder by default, in the e2e-framework too right?

@ahrtr
Copy link
Member Author

ahrtr commented Jan 22, 2025

@ahrtr: just meaning to confirm we want to rewrite the set of default tests, created by Kubebuilder by default, in the e2e-framework too right?

YES, the goal is to get rid of ginkgo completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed test
Projects
None yet
Development

No branches or pull requests

2 participants