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

Create common framework for e2e and integration tests and migrate TestKVPut test #13708

Merged
merged 3 commits into from
Feb 24, 2022

Conversation

serathius
Copy link
Member

Context #13637

After trying different approaches, I decided to go with picking single test and migrating them one by one.

cc @ahrtr @spzala @ptabor

@serathius
Copy link
Member Author

PTAL @ahrtr

tests/framework/interface.go Show resolved Hide resolved
}

func (c integrationClient) Put(key, value string) error {
_, err := c.Client.Put(context.Background(), key, value)
Copy link
Member

Choose a reason for hiding this comment

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

better not to ignore the first return value in framework, instead, let users to decide whether ignore it or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

The first argument is the PutResponse, I decided no not return it as most tests don't check the response assuming that request succeed. Implementing parsing PutResponse would make E2e client more complicated. Please remember that current interface is not final and is expect to evolve over time to handle new test cases.

*e2e.EtcdctlV3
}

func (c e2eClient) Get(key string, opts ...testutils.GetOption) (*clientv3.GetResponse, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I do not see Put method in this file.

var (
TestFramework testFramework = noFrameworkSelected{}
RunE2eTests testFramework = e2eFramework{}
RunIntegrationTests testFramework = integrationFramework{}
Copy link
Member

Choose a reason for hiding this comment

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

The names E2eFramework and IntegrationFramework make more sense than RunE2eTests and RunIntegrationTests

Copy link
Member Author

Choose a reason for hiding this comment

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

Still working out the naming, I decided on this name because it's more readable from user perspective. As a user name testFramework = framework.E2eFramework doesn't really explain what the change does. On the other handl testFramework = framework.RunE2eTests explains that it will configure tests to run E2e scenario.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Artur: Having boring names (that we name both enum and type the same) helps with code readability.

However we name it: runner / framework / harness, we should use this name consequently.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think going with TestRunner would be nicer. So E2eTestRunner and IntegrationTestRunner

@ahrtr
Copy link
Member

ahrtr commented Feb 18, 2022

The changes look much better than the existing design & implementation. But It would be even better if you can have a overall design (a big picture) and the directory layout.

Personally, I think the framework should be just a generic/common framework, it shouldn't have any code specific to e2e or integration tests. Both E2e and integration are just two extensions or implementations of the framework. The detailed design isn't super clear yet in my mind. I have a picture in the relate ticket although it may not accurate yet.

It's OK to merge this change for now because at least it's a big improvement. We can continue to refactor it later.

Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

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

Really nice !

tests/framework/e2e/etcdctl.go Outdated Show resolved Hide resolved
var (
TestFramework testFramework = noFrameworkSelected{}
RunE2eTests testFramework = e2eFramework{}
RunIntegrationTests testFramework = integrationFramework{}
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Artur: Having boring names (that we name both enum and type the same) helps with code readability.

However we name it: runner / framework / harness, we should use this name consequently.

tests/framework/framework.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2022

Codecov Report

Merging #13708 (04b0e64) into main (6af7601) will decrease coverage by 0.11%.
The diff coverage is 60.37%.

❗ Current head 04b0e64 differs from pull request most recent head 65be41d. Consider uploading reports for the commit 65be41d to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13708      +/-   ##
==========================================
- Coverage   72.76%   72.64%   -0.12%     
==========================================
  Files         467      467              
  Lines       38278    38287       +9     
==========================================
- Hits        27854    27815      -39     
- Misses       8623     8661      +38     
- Partials     1801     1811      +10     
Flag Coverage Δ
all 72.64% <60.37%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
server/etcdmain/etcd.go 45.48% <9.09%> (+0.32%) ⬆️
server/etcdserver/bootstrap.go 68.70% <50.00%> (-0.09%) ⬇️
server/embed/config.go 73.29% <53.33%> (-0.71%) ⬇️
server/etcdserver/api/v3discovery/discovery.go 80.27% <80.00%> (+0.27%) ⬆️
server/config/config.go 79.76% <100.00%> (+0.24%) ⬆️
server/embed/etcd.go 74.85% <100.00%> (+0.04%) ⬆️
server/etcdmain/config.go 85.26% <100.00%> (+0.31%) ⬆️
server/proxy/grpcproxy/register.go 69.76% <0.00%> (-9.31%) ⬇️
client/pkg/v3/tlsutil/tlsutil.go 83.33% <0.00%> (-8.34%) ⬇️
etcdctl/ctlv3/command/lease_command.go 65.34% <0.00%> (-5.95%) ⬇️
... and 25 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 6af7601...65be41d. Read the comment docs.

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.

4 participants