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 Txn tests to common framework #14000

Merged
merged 1 commit into from
May 11, 2022

Conversation

vimalk78
Copy link
Contributor

@vimalk78 vimalk78 commented Apr 30, 2022

This PR migrates Txn tests to common framework

This PR reuses functions from etcdctl package , and so adds dependency of etcdctl on tests.

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@vimalk78
Copy link
Contributor Author

vimalk78 commented Apr 30, 2022

The added dependency results in a test case failure

FAIL: inconsistent versions for depencency: go.etcd.io/etcd/etcdctl/v3
  - github.com/bgentry/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - github.com/dustin/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - github.com/olekukonko/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - github.com/spf13/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - github.com/spf13/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - go.etcd.io/etcd/api/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - go.etcd.io/etcd/client/pkg/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - go.etcd.io/etcd/client/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - go.etcd.io/etcd/etcdctl/[email protected] from: go.etcd.io/etcd/tests/v3
  - go.etcd.io/etcd/etcdctl/[email protected] from: go.etcd.io/etcd/v3
  - go.etcd.io/etcd/pkg/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - golang.org/x/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - google.golang.org/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - gopkg.in/cheggaaa/[email protected] from: go.etcd.io/etcd/etcdctl/v3
  - go.uber.org/[email protected] from: go.etcd.io/etcd/etcdctl/v3
FAIL: inconsistent dependencies
FAIL: 'dep' failed at Sat Apr 30 12:59:18 PM IST 2022

Need suggestion on how to avoid this extra dependency. There is a lot of code/test-code which can be reused across many packages. E..g code to parse rpc.Txn arguments. If this code is moved to a common package it can be used in both etcdctl and tests

@vimalk78
Copy link
Contributor Author

vimalk78 commented Apr 30, 2022

how to restart tests?

@vimalk78
Copy link
Contributor Author

/retest

Comment on lines 64 to 60
{
Name: "NoTLS",
Config: config.ClusterConfig{ClusterSize: 1},
},
{
Name: "PeerTLS",
Config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.ManualTLS},
},
{
Name: "PeerAutoTLS",
Config: config.ClusterConfig{ClusterSize: 3, PeerTLS: config.AutoTLS},
},
{
Name: "ClientTLS",
Config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.ManualTLS},
},
{
Name: "ClientAutoTLS",
Config: config.ClusterConfig{ClusterSize: 1, ClientTLS: config.AutoTLS},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@serathius this test config seems common in all test cases in tests/common , can we extract it out in a separate variable?

Copy link
Member

Choose a reason for hiding this comment

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

yea I think this is a good idea. I think can think about doing it in separate PR.

tests/common/txn_test.go Outdated Show resolved Hide resolved
tests/common/txn_test.go Outdated Show resolved Hide resolved
tests/go.mod Outdated Show resolved Hide resolved
@serathius
Copy link
Member

Overall great job! Apart of some nits this is exactly what we wanted.

@codecov-commenter
Copy link

codecov-commenter commented May 6, 2022

Codecov Report

Merging #14000 (55f0c96) into main (066e510) will decrease coverage by 0.10%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##             main   #14000      +/-   ##
==========================================
- Coverage   74.87%   74.77%   -0.11%     
==========================================
  Files         450      450              
  Lines       37173    37173              
==========================================
- Hits        27834    27795      -39     
- Misses       7560     7589      +29     
- Partials     1779     1789      +10     
Flag Coverage Δ
all 74.77% <80.00%> (-0.11%) ⬇️

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

Impacted Files Coverage Δ
etcdctl/ctlv3/command/watch_command.go 44.08% <0.00%> (ø)
etcdctl/ctlv3/command/txn_command.go 63.15% <100.00%> (-4.39%) ⬇️
etcdctl/ctlv3/command/util.go 17.97% <100.00%> (ø)
client/v3/concurrency/mutex.go 61.64% <0.00%> (-5.48%) ⬇️
server/proxy/grpcproxy/watch.go 92.48% <0.00%> (-4.05%) ⬇️
server/etcdserver/api/v3rpc/watch.go 83.55% <0.00%> (-3.03%) ⬇️
server/storage/mvcc/watchable_store.go 84.42% <0.00%> (-2.90%) ⬇️
etcdctl/ctlv3/command/printer_simple.go 53.08% <0.00%> (-2.47%) ⬇️
client/v3/concurrency/election.go 79.68% <0.00%> (-2.35%) ⬇️
... and 14 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 066e510...55f0c96. Read the comment docs.

@ptabor ptabor marked this pull request as draft May 6, 2022 11:02
@serathius
Copy link
Member

Please fix conflics

@vimalk78 vimalk78 marked this pull request as ready for review May 11, 2022 05:05
@vimalk78 vimalk78 changed the title WIP: tests: Migrate Txn tests to common framework tests: Migrate Txn tests to common framework May 11, 2022
@vimalk78
Copy link
Contributor Author

@serathius caution this PR has "partially fixes" in the top comment. shall i remove it?

@serathius
Copy link
Member

No need, removed it myself.

@serathius serathius merged commit 5fd6910 into etcd-io:main May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants