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

tests: Migrate endpoint tests to common framework #13774

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

kkkkun
Copy link
Contributor

@kkkkun kkkkun commented Mar 10, 2022

@kkkkun kkkkun force-pushed the endpoint-test branch 2 times, most recently from ddac11c to 2d7840e Compare March 10, 2022 13:53
@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2022

Codecov Report

Merging #13774 (45bf24c) into main (4e97271) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13774      +/-   ##
==========================================
- Coverage   72.75%   72.74%   -0.02%     
==========================================
  Files         467      467              
  Lines       38279    38643     +364     
==========================================
+ Hits        27850    28110     +260     
- Misses       8626     8721      +95     
- Partials     1803     1812       +9     
Flag Coverage Δ
all 72.74% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
etcdctl/ctlv3/command/printer.go 23.38% <0.00%> (-20.97%) ⬇️
etcdctl/ctlv3/command/ep_command.go 45.62% <0.00%> (-12.50%) ⬇️
client/pkg/v3/tlsutil/tlsutil.go 83.33% <0.00%> (-8.34%) ⬇️
server/etcdserver/api/v3rpc/lease.go 77.21% <0.00%> (-5.07%) ⬇️
raft/rafttest/node.go 95.00% <0.00%> (-5.00%) ⬇️
etcdctl/ctlv3/command/printer_simple.go 70.37% <0.00%> (-4.94%) ⬇️
server/storage/mvcc/watchable_store.go 85.14% <0.00%> (-3.99%) ⬇️
client/v3/leasing/cache.go 87.77% <0.00%> (-3.89%) ⬇️
client/v3/experimental/recipes/key.go 75.34% <0.00%> (-2.74%) ⬇️
client/v3/leasing/kv.go 89.70% <0.00%> (-1.67%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e97271...45bf24c. Read the comment docs.

@kkkkun kkkkun force-pushed the endpoint-test branch 3 times, most recently from 31599aa to 788aac0 Compare March 11, 2022 05:36
@kkkkun kkkkun changed the title WIP: tests: Migrate endpoint tests to common framework tests: Migrate endpoint tests to common framework Mar 11, 2022
tests/schema/schema.go Outdated Show resolved Hide resolved
tests/schema/schema.go Outdated Show resolved Hide resolved
@ahrtr
Copy link
Member

ahrtr commented Mar 14, 2022

A generic comment, usually when we migrate the test cases, we move the test cases from one place to another place (Of course, there maybe some refactor if needed), so there should be some cases being added, and some cases being deleted. But I do not see any code deletion in this PR.

If the code are reused somewhere else, then please try to migrate them together in ONE PR. On the other hand, try to keep each PR as small as possible, so as to make the code review easier. So please use your best judgement.

If somehow you can't follow either rule, then you need to clearly state the reason and plan/steps. For example, if you have to only add test cases in this PR and no any deletion, then you need to provide a reasonable reason, and the plan/steps to delete the related cases/code.

@kkkkun kkkkun force-pushed the endpoint-test branch 2 times, most recently from 0ad40f1 to 45bf24c Compare March 15, 2022 05:28
Copy link
Member

@serathius serathius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, aside of one comment


func (ctl *EtcdctlV3) Status() ([]*clientv3.StatusResponse, error) {
args := ctl.cmdArgs()
args = append(args, "endpoint", "status", "-w", "json")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to let users to configure the output format, and we can provide a default value. Ideally all the globalFlags should be configurable, we can even add the field into EtcdctlV3 (see below). Of course, it shouldn't be the scope/responsibility of this PR.

type EtcdctlV3 struct {
	clusterCfg       *EtcdProcessClusterConfig
        globalCfg        command.GlobalFlags{}
}

Copy link
Contributor Author

@kkkkun kkkkun Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to unmarshal it in line 197. And in line 182, it needs to print by json.
E2e test cases use one of format output. It should be different case by case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkkkun is right, the -w json is a binary specific flag that is needed to parse the output to return same proto response as integration tests. This flag and other e2e specific features will be useful when we also start working on e2e specific tests (tests that cannot be replicated for integration tests, like downgrade tests as they expect to run last release binary), however for now let's focus on migrating the common subset of tests.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one comment.

@serathius serathius merged commit 5ff2ecc into etcd-io:main Mar 16, 2022
@kkkkun kkkkun deleted the endpoint-test branch March 16, 2022 13:48
Comment on lines +188 to +198
func (c integrationClient) Health() error {
cli := healthpb.NewHealthClient(c.Client.ActiveConnection())
resp, err := cli.Check(context.TODO(), &healthpb.HealthCheckRequest{})
if err != nil {
return err
}
if resp.Status != healthpb.HealthCheckResponse_SERVING {
return fmt.Errorf("status expected %s, got %s", healthpb.HealthCheckResponse_SERVING, resp.Status)
}
return nil
}
Copy link
Member

@chaochn47 chaochn47 May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration test health implementation is different than e2e one which using etcdctl endpoints health that probes linearizable read and check if there is any active alarms. It's not a big issue but just want to call it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants