Skip to content

Conversation

@ivanvc
Copy link
Member

@ivanvc ivanvc commented Oct 30, 2025

Introduce the new functions: run_go_tests and run_go_test_expanding_packages, which implement (without Shellcheck exceptions) the old behavior from go_test, simplifying the arguments received.

Replaced the three possible values mode with:

  1. keep_going: By using the KEEP_GOING_TESTS environment variable. This mode expanded the relative modules; it can be run by using run_go_tests_expanding_packages.
  2. parallel: It worked without expanding the relative modules with the absolute modules. Therefore, this mode can be run directly using run_go_tests.
  3. fail_fast: By adding an argument "-failfast", and not setting the KEEP_GOING_TESTS environment variable.

The argument flags_for_package_func can be replaced by regular arguments passed to the function.

These two changes simplify the complexity of the go test wrapper function and allow further customization in the callers.

The JUnit XML generation works the same way, by reading the JUNIT_REPORT_DIR or ARTIFACTS environment variable. It generates the same reports.

Temporarily introduce the get_junit_filename_prefix function, as a replacement for junitFilenamePrefix. The latter will be removed once all test targets are using the new functions.

Finally, update the unit tests function to make use of the new functions, and allow running the tests by using the workspace (i.e., there's no need to change directories anymore).

Part of #18409.

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

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivanvc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ivanvc ivanvc mentioned this pull request Oct 30, 2025
32 tasks
@ivanvc ivanvc force-pushed the migrate-test-unit-to-use-workspace branch 6 times, most recently from 6fabb4a to 0f51f15 Compare October 30, 2025 16:45
@ivanvc
Copy link
Member Author

ivanvc commented Oct 30, 2025

/test all

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.11%. Comparing base (31fbd99) to head (cef8274).

Additional details and impacted files

see 20 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #20872      +/-   ##
==========================================
- Coverage   69.20%   69.11%   -0.10%     
==========================================
  Files         422      422              
  Lines       34831    34831              
==========================================
- Hits        24104    24072      -32     
- Misses       9328     9354      +26     
- Partials     1399     1405       +6     

Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Introduce the new functions: run_go_tests and
run_go_test_expanding_packages, which implement (without Shellcheck
exceptions) the old behavior from go_test, simplifying the arguments
received.

Replaced the three possible values mode with:

1. keep_going: By using the KEEP_GOING_TESTS environment variable. This
   mode expanded the relative modules; it can be run by using
   run_go_tests_expanding_packages.
2. parallel: It worked without expanding the relative modules with the
   absolute modules. Therefore, this mode can be run directly using
   run_go_tests.
3. fail_fast: By adding an argument "-failfast", and not setting the
   KEEP_GOING_TESTS environment variable.

The argument flags_for_package_func can be replaced by regular arguments
passed to the function.

These two changes simplify the complexity of the go test wrapper
function and allow further customization in the callers.

The JUnit XML generation works the same way, by reading the
JUNIT_REPORT_DIR or ARTIFACTS environment variable. It generates the
same reports.

Temporarily introduce the get_junit_filename_prefix function, as a
replacement for junitFilenamePrefix. The latter will be removed once all
test targets are using the new functions.

Finally, update the unit tests function to make use of the new
functions, and allow running the tests by using the workspace (i.e.,
there's no need to change directories anymore).

Signed-off-by: Ivan Valdes <[email protected]>
@ivanvc ivanvc force-pushed the migrate-test-unit-to-use-workspace branch from 0f51f15 to cef8274 Compare November 4, 2025 00:54
@ivanvc ivanvc marked this pull request as ready for review November 4, 2025 00:55
@ivanvc
Copy link
Member Author

ivanvc commented Nov 4, 2025

/retest

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.

2 participants