1
0
mirror of https://github.com/etcd-io/etcd.git synced 2026-02-05 15:46:51 +01:00
Commit Graph

506 Commits

Author SHA1 Message Date
Davanum Srinivas
386eb3023d test: fix robustness tests failing with undefined -bin-dir flag
The robustness CI jobs are failing with "flag provided but not defined:
-bin-dir" because the test path includes subpackages (./tests/robustness/...)
that don't register this flag.

PR 20962 changed the test invocation to use ./tests/robustness/... which
runs tests in all subpackages. The validate/ and model/ subpackages contain
unit tests that don't import framework/e2e (which registers -bin-dir), so
they fail when this flag is passed.

PR 21039 attempted to fix the issue but only changed the test runner
function, not the package path.

This change removes the /... suffix to only run tests in the main
robustness package, restoring the original behavior.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-12-21 16:08:06 -05:00
Ivan Valdes
8fddf7d1fe Fix robustness tests execution
Remove running the tests for all the packages under ./tests/robustness.
Restore the old behavior of running only the tests from the top-level
robustness package.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-12-18 21:58:17 -08:00
Ivan Valdes
5718233f0b Fix run_go_tests_expanding_packages argument parsing
Escape the regular expression, and ensure to capture go.etcd.io
packages, too. As defined in `run_go_tests`.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-12-17 16:30:55 -08:00
Ivan Valdes
e8ed6c3f21 Migrate robustness tests to use Go workspace
Switch the robustness tests to use the new run_go_tests function.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-11-20 15:01:49 -08:00
Ivan Valdes
e1c2aaef98 Migrate grpcproxy tests to use Go workspace
Switch the grpcproxy integration and e2e tests to use the new
run_go_tests function.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-11-19 14:14:50 -08:00
Marek Siarkowicz
d6f85c53d6 Disable optimization and inlining for Antithesis to make using debugger easier
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2025-11-16 22:56:33 +01:00
Benjamin Wang
9422ca0051 Merge pull request #20909 from ivanvc/migrate-integration-tests
Migrate integration tests to use Go workspace
2025-11-14 11:36:49 +00:00
Ivan Valdes
570c124214 Migrate e2e tests to use Go workspace
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-11-12 09:59:29 -05:00
Ivan Valdes
eef2b22c21 Migrate integration tests to use Go workspace
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-11-09 16:04:46 -05:00
Ivan Valdes
cef82740c3 Migrate unit tests to use Go workspace
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 <ivan@vald.es>
2025-11-03 16:53:49 -08:00
Ivan Valdes
3e57a179da Replace GOLANG_TEST_SHORT with testing.Short()
Remove the custom environment variable GOLANG_TEST_SHORT.

It is currently used by Main tests (TestMain), as we can't skip tests
because testing.M doesn't implement testing.TB. It is possible to do a
clean os.Exit(0) (current behavior), but calling testing.Short() fails
because this function expects flags to be parsed before.

So, it is possible to remove the custom behavior (GOLANG_TEST_SHORT) by
parsing flags (if required) before calling testing.Short(), then
immediately exit if the result is true (-short flag is set).

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-30 10:19:54 -07:00
Ivan Valdes
6829e34749 Delete scripts/fix.sh
All of the passes have been moved out to different script files.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-28 14:15:27 -07:00
Ivan Valdes
75c5654138 Move fix-bashws to its own script
Follow the approach of a script per Makefile target. Rename it to
shell_ws for consistency with the verify target.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-27 23:00:40 -07:00
Benjamin Wang
0ca76b28c4 Merge pull request #20858 from ivanvc/use-golangci-lint-gofmt-fix
Don't manually run go fmt
2025-10-27 09:13:46 +00:00
Benjamin Wang
4807b85fe8 Merge pull request #20857 from ivanvc/update-fix-yamllint-to-use-new-script
Update fix-yamllint Makefile target to use stand-alone script
2025-10-26 10:10:34 +00:00
Ivan Valdes
1bb0d8476d Don't manually run go fmt
We're already calling golangci-lint --fix. We require the gofmt
formatter, and it supports autofix. Therefore, running go fmt manually
after golangci-lint --fix runs doesn't have any effect.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-26 00:17:55 -07:00
Benjamin Wang
6dc06f19b2 Merge pull request #20848 from ivanvc/update-verify-dep-to-use-workspace
Update verify-dep to use workspace helpers
2025-10-25 14:07:52 +01:00
Ivan Valdes
b16a46eaad Update fix-yamllint to use a new stand-alone script
Implement a new stand-alone script to move the target body out of the
Makefile.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-24 16:30:30 -07:00
Benjamin Wang
ee6aad2e47 Fix the golangci-lint installation script to get the correct GOPATH
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2025-10-24 10:45:42 +01:00
Marek Siarkowicz
2a7f098e06 Merge pull request #20851 from ivanvc/move-fix-go-mod-to-a-makefile-target
Move go mod tidy to a test.sh pass, update it to use the Go workspace
2025-10-24 11:33:06 +02:00
Ivan Valdes
f5efd747fe Move go mod tidy to a test.sh pass
Use the new workspace helper functions.

By moving it to a test.sh pass, we can chain it in the fix Makefile
target prerequisites, and it can be called before update-go-workspace.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-23 21:08:52 -07:00
Ivan Valdes
16c44e2eb5 Update gomodguard to use workspace modules
Optimize running the gomodguard binary, by only installing it once.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-23 15:58:04 -07:00
Ivan Valdes
2d18e5d10e Update verify-dep to use workspace helpers
There's no need to add an exception for tools/mod anymore, as this is
considered part of the workspace.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-23 15:17:25 -07:00
Benjamin Wang
1f1750b196 Merge pull request #20828 from ivanvc/update-mod-tidy-check
Update mod tidy check to not use old module system
2025-10-23 16:45:35 +01:00
Ivan Valdes
5ea3e184fe Update mod tidy check to use the workspace modules
Use a new function for commands that need to change directories to the
Go workspace module sub directory. For example, go mod doesn't receive
arguments, it needs to run from the directory that has the go.mod file.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-22 17:26:46 -07:00
Ivan Valdes
5bf8e5ae50 Use workspace modules to generate the bom
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-22 13:11:34 -07:00
Ivan Valdes
be2e2306c3 Use workspace modules for verify bom
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-22 13:09:12 -07:00
Benjamin Wang
7c87fe3ef3 Merge pull request #20811 from ivanvc/silence-bom-expected-error
Silence BOM first run expected error
2025-10-22 20:57:41 +01:00
Ivan Valdes
492cf3e794 Replace force word splitting with a Bash array
Currently, we need to force word splitting, as we need to pass multiple
arguments, not a single one, to the command that will run using the
workspace modules.

To properly remove this exception, we need to use an array. The problem
with Bash arrays is that you can't return them in a function. So, the
way to build an array is by reference. Otherwise, we'll end up
rebuilding the arrays every time we need to call these functions.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-22 11:52:48 -07:00
Ivan Valdes
c05638f34f Remove verify-license-header check
This is now replaced by the golangci-lint goheader linter.

Deletes the bash helper go_srcs_in_module, as it is not used anymore by
any other static check functions.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-19 21:45:34 -07:00
Ivan Valdes
76658e8fa4 Remove gofmt static check
The gofmt static check is already part of golangci-lint's gofmt
formatter. Therefore, it's a duplicate check. We can simplify and let
golangci-lint do the heavy lifting.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-18 20:38:09 -07:00
Ivan Valdes
2811b235db Remove goword linter
This is replaced by golangci-lint's misspell.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-17 13:40:16 -07:00
Ivan Valdes
56b582fd36 Silence BOM first run expected error
The tool github.com/appscodelabs/license-bill-of-materials fails during
the first run in a recently cloned/fresh repository. Because it captures
the output, and the first run shows the download of dependencies. In
8b02416301, we intentionally added a new
execution before evaluating whether the BOM is up to date. However, this
is polluting the logs as it has the expected failure. Redirecting the
output to /dev/null alleviates the issue.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-16 11:40:31 -07:00
Ivan Valdes
c9d95d208f Run govet shadow using golangci-lint
Using shadow from golangci-lint doesn't lint generated files
(protobufs), so it's safe to include all the files.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-16 09:56:03 -07:00
Ivan Valdes
0a64959f8a Run govet from golangci-lint
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-16 09:34:26 -07:00
Ivan Valdes
a2c1df59f5 Update golangci-lint to work with Go workspace
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-15 16:53:55 -07:00
Ivan Valdes
b24e869c79 scripts: add run_for_all_workspace_modules function
Adds workspace_relative_modules, and run_for_all_workspace_modules which
runs a given function for all the workspace module from the top-level of
the repository, without iterating by module/directory.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-11 00:27:23 -07:00
Ivan Valdes
8b02416301 Fix running BOM on fresh clones
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-03 15:54:57 -07:00
Ivan Valdes
db7fef26a7 Migrate bom command to use a Go workspace
Remove `GOFLAGS=-mod=mod` from the execution of
license-bill-of-materials.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-03 15:54:57 -07:00
Ivan Valdes
2b1b74a457 Migrate verify-go-versions to use a Go workspace
Add checking for the Go toolchain directive in the go.work file too.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-03 15:54:57 -07:00
Ivan Valdes
f06855c2e0 Add verify-go-workspace make target
Introduce a new `verify-go-workspace` make target executed by the
`verify` target. The pull-etcd-verify presubmit prow job will execute
it. It ensures that the Go workspace (`go.work` and `go.work.sum`) is in
sync.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-03 15:54:56 -07:00
Ivan Valdes
913a1e9667 Enable Go workspace
Introduce a new Go workspace that references all the current submodules.
To preserve the current behavior, point all of the current
FORBIDDEN_DEPENCENCY virtual dependencies to the same path.

Add scripts/update_go_workspace.sh that generates the Go workspace file
(go.work) based on the submodules found in the project (excluding the
tools) and creates the go.work.sum file after running go mod download.
Added this script to the fix Makefile target. Even though, the number of
modules in the etcd repository is small, by adding an automated way of
updating the go.work modules future proofs the project in case there are
new modules or removal of them.

Remove the workaround to forbid dependencies through the
FORBIDDEN_DEPENDENCY replace. This can be done through a linter rather
than at the go.mod level. Using the go.mod approach also brings issues
with the workspace, as all the dependencies (including replaces) need to
have a consistent version and point to the same place.

Co-authored-by: Tim Hockin <thockin@google.com>
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-10-03 15:54:54 -07:00
Ivan Valdes
678df5f5fb Add gomodguard to verify forbidden dependencies
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-09-30 11:36:21 -07:00
shenmu.wy
f15c68f7be install dependencies for darwin arm64 when running verify_golangci-lint_version.sh and verify_genproto.sh
Signed-off-by: shenmu.wy <shenmu.wy@antfin.com>
2025-09-24 14:49:26 +08:00
Ivan Valdes
4c021f7c65 Add documentation to tool_get_bin
Stating that it only works for tools managed by tools/mod.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-09-11 22:29:00 -07:00
Ivan Valdes
437513a1c4 Install govulncheck from scripts/test.sh
Ensure that GOTOOLCHAIN is set by the time it runs, to ensure the binary
gets compiled with the right Go version.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-09-11 22:26:15 -07:00
Ivan Valdes
cbee95f989 dependency: bump golangci-lint from 1.64.8 to v2.4.0
Signed-off-by: Ivan Valdes <ivan@vald.es>
2025-09-08 10:26:00 -07:00
Kishen Viswanathan
20d6e5d7a6 Fix error related to missing directory for mktemp command
Signed-off-by: Kishen Viswanathan <kishen.viswanathan@ibm.com>
2025-08-18 13:05:03 +05:30
Kishen Viswanathan
1484c3e9a0 Add make target for running benchmark tests
Add in the copyright test for benchmark_test.sh

Co-authored-by: Marek Siarkowicz <marek.siarkowicz@protonmail.com>
Signed-off-by: Kishen Viswanathan <kishen.viswanathan@ibm.com>
2025-08-12 18:16:00 +05:30
sprochazka
2a74015caa Tooling: Added licenses headers in cript directory
Licensed since 2025

Signed-off-by: sprochazka <s.prochazka6@gmail.com>
2025-07-15 20:41:54 +00:00