Commit graph

890 commits

Author SHA1 Message Date
Patrick Ohly
f38660b14b test: move list of extra tests into separate file
This is a bit easier to edit than directly in the bash script.
2026-04-27 09:18:11 +02:00
Patrick Ohly
10c7bcd50b test: also run unit tests for package under hack/tools
This is currently only the
k8s.io/kubernetes/hack/tools/golangci-lint/sorted/pkg linter implementation.
2026-04-24 16:40:35 +02:00
Patrick Ohly
fe06a4c3cc test: support running upstream unit tests
The logtools linter broke a while ago when moving to more recent Go and/or more
recent dependencies such that it stopped reporting certain issues. This was
only noticed much later when a broken log call was found in the code base which
should have been flagged as wrong by the linter.

It is possible to run upstream Go unit tests in a downstream project. This is
now done for logtools if (and only if) no explicit test targets are
selected. Because hack/tools is not part of the workspace, this only works
after changing directories. gotestsum gets invoked once for the root and this
additional directory with different result files and set of test targets.

We could add more upstream tests. etcd tests were mentioned as something where
that would be useful. However, right now upstream etcd tests have some
dependencies on being run inside the original source tree, so that would have
to be fixed first. For now only single etcd client package gets tests as
a proof-of-concept of the new support for testing vendored upstream packages.
For those, -mod=readonly is needed to avoid:

    $ go test go.etcd.io/etcd/client/pkg/v3/fileutil
    ?   	go.etcd.io/etcd/client/pkg/v3/fileutil	[no test files]
2026-04-24 16:40:35 +02:00
Jefftree
09333f1a97 Fix ulimit check 2026-02-02 21:33:05 -05:00
Patrick Ohly
817e8cd898 make test: fix support for PARALLEL
There was an env variable PARALLEL and a -p command line flag,
but the value then wasn't passed on to "go test".

The new default is to not set any explicit parallelism, which
matches the prior (accidental?) behavior of ignoring PARALLEL.
2025-12-30 12:22:13 +01:00
Kubernetes Prow Robot
710c80f72a
Merge pull request #133503 from p0lyn0mial/upstream-disable-panic-watch-decode-err-for-integration
test-integration: set KUBE_PANIC_WATCH_DECODE_ERROR to false
2025-10-31 02:52:03 -07:00
Benjamin Elder
88d6e6c465 drop automaxprocs hacks now that go 1.25 handles this built in
https://go.dev/doc/go1.25#container-aware-gomaxprocs
2025-09-17 16:36:15 -07:00
Patrick Ohly
0b647319c4 hack: more output about running tests
set -x/+x wraps setting relevant configuration variables to debug how and where
they get sets. The final gotestsum invocation gets logged in addition to being
run.
2025-08-18 14:33:57 +02:00
Lukasz Szaszkiewicz
cb1d04655f test-integration: set KUBE_PANIC_WATCH_DECODE_ERROR to false 2025-08-13 13:32:44 +02:00
Patrick Ohly
356be5ae30 DRA E2E: move upgrade/downgrade test into test/e2e_dra
It's similar to test/e2e_kubeadm in the sense that it is a test which must be
excluded from both "make test" and "make integration" by default.
2025-07-15 12:54:40 +02:00
yongruilin
8b2eb9090e chore: Remove vet target and associated script from Makefile and hack directory 2025-06-25 17:39:14 +00:00
Patrick Ohly
6cb14884b6 test-integration: allow enabling race detection
A job may now enable race detection via KUBE_RACE=-race.
2025-06-02 11:47:42 +02:00
Patrick Ohly
2a9a3ea827 test: switch gotestsum quiet output format
"--format standard-quiet" shows log output on stderr (= klog logging) if it
occurs outside of a test (= test has leaked something). That is inconsistent
with "go test" without -v and a problem for pull-kubernetes-unit because many
tests do not clean up properly.

"pkgname-and-test-fails" hides the extra output and seems similar enough:

       pkgname-and-test-fails   print a line for each package and failed test output

    $ gotestsum --format pkgname-and-test-fails ./test/internal/logging --count=1
    ✓  test/internal/logging (5.007s)

    DONE 1 tests in 5.384s
2025-03-20 12:09:44 +01:00
Siyuan Zhang
a9514b0591 Add update-featuregates to update.sh
Signed-off-by: Siyuan Zhang <sizhang@google.com>
2025-03-13 15:53:06 -07:00
Jordan Liggitt
0ce48b5636
Honor KUBE_HACK_TOOLS_GOTOOLCHAIN 2025-02-14 13:01:59 -05:00
elieser pereira
35f584187a
accept GINKGO_FLAGS for test-e2e-node.sh (#129215)
* accept GINKGO_FLAGS for test-e2e-node.sh

* Update Makefile to document LABEL_FILTER

* --label-filter part of ginkgoflags

* Update Makefile

* if label-filter then avoid skip and focus defaults

* LABEL_FILTER can be empty

* Update build/root/Makefile

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

* skip defaults only if label-filter not set

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

* focus and label_fiter can live together

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

* skip and label_filter can live together

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

---------

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-12-24 02:48:10 +01:00
Benjamin Elder
a43b00b429 make test-cmd: use kube::util::find-binary to get kubeadm binary
fixes finding the binary when dockerized builds vs host builds
2024-11-26 17:33:44 -08:00
Patrick Ohly
25a4758bcc testing: allow keeping detailed go test JUnit results
Pruning of tests to the top-level test was added for jobs like
pull-kubernetes-unit which run many tests. For other, more focused jobs like
scheduler-perf benchmarking it would be nice to keep the more detailed
information, in particular because it includes the duration per test case.
2024-11-18 12:44:34 +01:00
Kubernetes Prow Robot
1bda3efdf4
Merge pull request #127754 from skitt/followup-module-verify
hack verify.sh: clean up "base"
2024-10-13 02:24:19 +01:00
Jordan Liggitt
ada932a6e2
Simplify update-vendor.sh to use go work sync 2024-10-10 17:58:54 -04:00
Kubernetes Prow Robot
b613a5c249
Merge pull request #127597 from bouaouda-achraf/e2e-test-duplicate-param-runtime-config
fix(e2e-node-tests):  duplicate flag "--runtime-config" when calling run_remote.go on test-e2e-node.sh
2024-10-04 21:52:27 +01:00
Stephen Kitt
be0cd199d1
hack verify.sh: clean up "base"
This is a follow-up for commit beb51e1 ("make verify: run checks in
all module hack directories"). Checking only modules known to go ends
up ignoring modules which aren't dependencies, such as
./staging/src/k8s.io/code-generator/examples/hack; but the checks
should be run there too. So this finds modules by looking for go.mod
files.

Use PWD in run-checks to record failing verification scripts instead
of a hidden dependency on an externally-set variable.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-09-30 18:12:39 +02:00
Kubernetes Prow Robot
f49fadb4ed
Merge pull request #127472 from skitt/fix-client-go-extensions-broken
Run staging verify scripts from the main make verify
2024-09-28 03:56:08 +01:00
Kubernetes Prow Robot
a8c955ab42
Merge pull request #127606 from thockin/skip_test_target_normalization
Skip Go target normalization in integration tests
2024-09-27 04:42:01 +01:00
Stephen Kitt
beb51e1759
make verify: run checks in all module hack directories
This ensures that all verification scripts are run throughout the
repository.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-09-26 08:46:04 +02:00
Kubernetes Prow Robot
239802e4f7
Merge pull request #127574 from bouaouda-achraf/e2e-test-add-network-subnet-param
feat(test-e2e): support custom network and subnet on remote e2e mode
2024-09-26 03:50:08 +01:00
Tim Hockin
cf280dd6c2
Skip Go target normalization in integration tests 2024-09-25 13:15:48 -07:00
Tim Hockin
8912df652b
Use Go workspaces + go list to find test targets
Plain old UNIX find requires us to do all sorts of silly filtering.
2024-09-24 09:04:13 -07:00
ACHRAF BOUAOUDA
2a07104757
fix(e2e-node-tests): duplicate flag "--runtime-config" on run_remote.go 2024-09-24 17:26:43 +02:00
Tim Hockin
7d89e9b4c0
Only normalize user-provided test targets 2024-09-23 16:25:29 -07:00
Achraf BOUAOUDA
d900efafcc feat(test-e2e): support custom network and subnet on remote e2e mode 2024-09-24 00:25:41 +02:00
Achraf BOUAOUDA
e645e06a7f fix(e2e-node-tests): project and zone in the prerequisites check 2024-09-19 12:23:08 +02:00
Patrick Ohly
a7da865aa8 test: filter "go test" output with gotestsum instead of grep
Filtering the output with grep leads to hard to read log output, e.g. from
pull-kubernetes-unit:

    +++ [0613 15:32:48] Running tests without code coverage and with -race
    {"Time":"2024-06-13T15:33:47.845457374Z","Action":"output","Package":"k8s.io/kubernetes/cluster/gce/cos","Test":"TestCreateMasterAuditPolicy","Output":"        /tmp/configure-helper-test47992121/kube-env: line 1: `}'\n"}
    {"Time":"2024-06-13T15:33:49.053732803Z","Action":"output","Package":"k8s.io/kubernetes/cluster/gce/cos","Output":"ok  \tk8s.io/kubernetes/cluster/gce/cos\t2.906s\n"}

We can do better than that. When feeding the output of the "go test" command(s)
into gotestsum *while it runs*, we can use --format=standard-quiet (= normal go
test output) or --format=standard-verbose (= `go test -v`) when FULL_LOG is
requested to get nicer output.

This works when testing everything at once. This was said to be not possible
when doing coverage profiling. But recent Go no longer has that limitation, so
the xargs trick gets removed. All that we need to do for coverage profiling is
to add some additional parameters and the conversion to HTML.
2024-08-19 16:14:05 +02:00
Kubernetes Prow Robot
69dbf2eee9
Merge pull request #126665 from liggitt/version-build-id
Restore honoring --version build ID overrides
2024-08-13 22:12:17 -07:00
Jordan Liggitt
c181912dc5
Restore honoring --version build ID overrides 2024-08-13 21:52:58 -04:00
Siyuan Zhang
35488ef5c7 Verify: add static analysis to verify new feature gates are added as versioned feature specs.
Signed-off-by: Siyuan Zhang <sizhang@google.com>
2024-08-01 13:52:32 -07:00
Kubernetes Prow Robot
3d24b962be
Merge pull request #124505 from jsafrane/clean-pvlabeler
Remove PersistentVolumeLabel admission plugin
2024-05-09 08:52:48 -07:00
Jan Safranek
e7a6ed2e3d Remove PersistentVolumeLabel admission plugin
Remove useless admission plugin.

* It has been deprecated for years.
* All in-tree cloud providers were removed, so the admission plugin does not have
  any way to get PV labels.
* There is a replacement in https://github.com/kubernetes-sigs/cloud-pv-admission-labeler
2024-05-09 11:10:14 +02:00
Davanum Srinivas
fa7cdf81cc
Drop typecheck-providerless verification
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-05-07 08:24:15 -04:00
Kubernetes Prow Robot
d8f8c7fae0
Merge pull request #124288 from pohly/test-e2e-node-debugger
e2e node: debugger support
2024-04-22 08:43:27 -07:00
Patrick Ohly
d97b67d97a e2e node: support running the test binary under a debugger
Single-stepping interactively through a test can be useful to understand what's
happening and to investigate the state at each step.

Similar support was added early to hack/ginkgo-e2e.sh, so the same env variable
is used again.
2024-04-16 11:46:28 +02:00
Ed Bartosh
91099aca72 hacks: build main target without go in the PATH
`make` is able to build project binaries, but fails with
error `hack/lib/golang.sh: line 455: go: command not found`
trying to place them if go binary is not in the PATH.
This happens because kube::golang::place_bins uses different
environment than kube::golang::build_binaries.

Setting up an one environment for both `kube::golang::place_bins`
and `kube::golang::build_binaries` should solve this issue and allow
default make target to fully work without go binary in the PATH.
2024-04-05 17:36:57 +03:00
Tim Hockin
a0215badb8
Change pushd $d; go ...; popd to go -C $d ...
Just an annoyance in reading these scripts.
2024-03-02 14:40:10 -08:00
Tim Hockin
5a96a56c80
Fix make test-integration for workspaces 2024-02-29 22:06:57 -08:00
Tim Hockin
e84adf611f
Remove references to "GO111MODULE" 2024-02-29 22:06:55 -08:00
Tim Hockin
d772f7719d
Remove defunct references to "vendor" 2024-02-29 22:06:52 -08:00
Tim Hockin
10c32b3e2f
Get rid of most references to GOPATH 2024-02-29 22:06:51 -08:00
Tim Hockin
530c4352fb
Rename new::setup_env back to setup_env 2024-02-29 22:06:44 -08:00
Tim Hockin
c79e5abec4
Change test-e2e-node to use new setup_env 2024-02-29 22:06:17 -08:00
Tim Hockin
5f490b4fe8
Clarify, document KUBE_OUTPUT_* variables 2024-02-29 22:05:42 -08:00