etcd icon indicating copy to clipboard operation
etcd copied to clipboard

tests: add WaitLeader function to common framework

Open clement2026 opened this issue 3 years ago • 4 comments

This PR relates to #14305

clement2026 avatar Aug 03 '22 09:08 clement2026

Codecov Report

Merging #14304 (b2726c4) into main (b2726c4) will not change coverage. The diff coverage is n/a.

:exclamation: Current head b2726c4 differs from pull request most recent head b211a30. Consider uploading reports for the commit b211a30 to get more accurate results

@@           Coverage Diff           @@
##             main   #14304   +/-   ##
=======================================
  Coverage   75.63%   75.63%           
=======================================
  Files         457      457           
  Lines       37048    37048           
=======================================
  Hits        28020    28020           
  Misses       7288     7288           
  Partials     1740     1740           
Flag Coverage Δ
all 75.63% <0.00%> (ø)

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

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov-commenter avatar Aug 04 '22 05:08 codecov-commenter

Created amended version of your PR https://github.com/etcd-io/etcd/pull/14313 as an example. It's a draft to showcase possible solution. I'll close it out and we can keep working on this PR.

The idea is to convert WaitLeader and WaitMembersForLeader to helper functions that use Cluster interface. In integration/cluster.go, integrationCluster can be converted and we can use the same helper.

@serathius this might be a good use case for you to review. How do we share implementation of methods that only use Cluster interface? Instead of helper methods we can use embeddings, but that will change your original interface.

lavacat avatar Aug 05 '22 07:08 lavacat

Created amended version of your PR #14313 as an example. It's a draft to showcase possible solution. I'll close it out and we can keep working on this PR.

The idea is to convert WaitLeader and WaitMembersForLeader to helper functions that use Cluster interface. In integration/cluster.go, integrationCluster can be converted and we can use the same helper.

@serathius this might be a good use case for you to review. How do we share implementation of methods that only use Cluster interface? Instead of helper methods we can use embeddings, but that will change your original interface.

It's a neat solution in a more idiomatic way. I really like it :)

clement2026 avatar Aug 05 '22 08:08 clement2026

cc @ahrtr @spzala as I'm on vacation.

serathius avatar Aug 07 '22 11:08 serathius

@spzala This PR is good to go for me. Do you have any other comments or concerns? thx

ahrtr avatar Aug 13 '22 21:08 ahrtr

Thanks @spzala

Great work! @clarkfw

ahrtr avatar Aug 14 '22 05:08 ahrtr

Thanks to @ahrtr and @spzala for your help! This PR won't have gone so well without your collaboration.

clement2026 avatar Aug 14 '22 12:08 clement2026