Commit Graph

473 Commits (21a25215b281c41f2aa26f15866fa77a3b872c07)

Author SHA1 Message Date
Nir Soffer 7bdf00c4f1 test: Skip image save to file with containerd
This tests cannot pass now due to #21408. This should be reverted when
we fix the issue.
2025-08-24 17:49:27 +03:00
Nir Soffer 8d94f99b60 test: Check saved image
Previously we check that the file exist which is not enough since with
containerd runtime `image save` we get an empty file (#21408).

Now we try to read the tar file and fail if we cannot read at least one
header, and we log the contents for debugging.

With this change ImageSaveToFile and ImageLoadFromFile fail early with
clear error. Previously ImageSaveToFile succeeded created empty file,
and ImageLoadFromFile failed with much longer and harder to understand
error logs.

Example run with docker runtime:

    === RUN   TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:566: (dbg) Run:  out/minikube -p functional-712000 image ls --format short

    === NAME  TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:623: (dbg) Run:  out/minikube -p functional-712000 image save registry.k8s.io/pause:latest /var/.../test.tar --alsologtostderr

    === NAME  TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:520: tar: blobs/ (0 bytes)
        functional_test.go:520: tar: blobs/sha256/ (0 bytes)
        functional_test.go:520: tar: blobs/sha256/5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef (1024 bytes)
        functional_test.go:520: tar: blobs/sha256/8cb2091f603e75187e2f6226c5901d12e00b1d1f778c6471ae4578e8a1c4724a (862 bytes)
        functional_test.go:520: tar: blobs/sha256/ac1aaec37732e181631ff5ecd6e89fc37beafe3ea63589075c3ae2c7c7e6ef2f (401 bytes)
        functional_test.go:520: tar: blobs/sha256/ad6f202d9ebc6878d90ffe7606a5c219a4155fee7b6d0032266053c6500cc352 (1042 bytes)
        functional_test.go:520: tar: blobs/sha256/b80dff767ab7ca9d1e43e874be74d34560c8bda1a1e4717790d8cc2a573fefc7 (477 bytes)
        functional_test.go:520: tar: blobs/sha256/e16a89738269fec22db26ec6362823a9ec42d0163685d88ba03c4fb5d5e723f6 (241664 bytes)
        functional_test.go:520: tar: blobs/sha256/f4b88e6ef8afe83e03b936888755b5a7517650bab05e73c4710b9542c049bdcb (699 bytes)
        functional_test.go:520: tar: index.json (359 bytes)
        functional_test.go:520: tar: manifest.json (855 bytes)
        functional_test.go:520: tar: oci-layout (31 bytes)
        functional_test.go:520: tar: repositories (104 bytes)

Example run with containerd runtime:

    === RUN   TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:566: (dbg) Run:  out/minikube -p functional-109000 image ls --format short
        functional_test.go:623: (dbg) Run:  out/minikube -p functional-109000 image save registry.k8s.io/pause:3.10 /var/.../test.tar --alsologtostderr
        functional_test.go:525: tar file is empty: "/var/folders/.../test.tar"

Example run with cri-o runtime:

    === RUN   TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:566: (dbg) Run:  out/minikube -p functional-418000 image ls --format short
    === NAME  TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:623: (dbg) Run:  out/minikube -p functional-418000 image save registry.k8s.io/pause:3.10 /var/.../test.tar --alsologtostderr
    === NAME  TestFunctional/parallel/ImageCommands/ImageSaveToFile
        functional_test.go:520: tar: blobs/ (0 bytes)
        functional_test.go:520: tar: blobs/sha256/ (0 bytes)
        functional_test.go:520: tar: blobs/sha256/1975aab740f75a0e29b0dc8da5e898fcd3d70a5792becd9a847b4c7515cf154f (515584 bytes)
        functional_test.go:520: tar: blobs/sha256/afb61768ce381961ca0beff95337601f29dc70ff3ed14e5e4b3e5699057e6aa8 (886 bytes)
        functional_test.go:520: tar: blobs/sha256/b2bb3889281dcb7d517ca61ef4856f4529c695c32272b454f05b0d6b831d131e (399 bytes)
        functional_test.go:520: tar: blobs/sha256/e1df216055fb593d78bf169d2e455ce6a233289cf40db7997f895939f2f68364 (789 bytes)
        functional_test.go:520: tar: index.json (355 bytes)
        functional_test.go:520: tar: manifest.json (469 bytes)
        functional_test.go:520: tar: oci-layout (31 bytes)
        functional_test.go:520: tar: repositories (102 bytes)
2025-08-24 14:43:54 +03:00
Nir Soffer 64d64ebda3 test: Rename taggedImage to daemonTestImage
This share image name create by SetupDaemon and used by the Image*Daemon
tests. Rename to make this more clear.
2025-08-24 14:43:54 +03:00
Nir Soffer dacee036c1 test: Skip tests that require docker daemon
Skip tests that require a docker daemon if one is not available on the
host. This eliminate the skip on github actions on darwin, enabling
image tests that were previously skipped.

With this change functional tests pass on macOS and may pass also in
github actions.

    --- PASS: TestFunctional/parallel/ImageCommands (1.62s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageListShort (0.07s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageListTable (0.07s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageListJSON (0.07s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageListYAML (0.07s)
        --- SKIP: TestFunctional/parallel/ImageCommands/SetupDaemon (0.00s)
        --- SKIP: TestFunctional/parallel/ImageCommands/ImageLoadFromDaemon (0.00s)
        --- SKIP: TestFunctional/parallel/ImageCommands/ImageReloadFromDaemon (0.00s)
        --- SKIP: TestFunctional/parallel/ImageCommands/ImageTagAndLoadFromDaemon (0.00s)
        --- SKIP: TestFunctional/parallel/ImageCommands/ImageSaveToDaemon (0.00s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageTag (0.30s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageRemove (0.29s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageSaveToFile (0.17s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageLoadFromFile (0.58s)
        --- PASS: TestFunctional/parallel/ImageCommands/ImageBuild (4.21s)
2025-08-24 14:43:54 +03:00
Nir Soffer 79391d138d test: Rewrite independent images tests
Rewrite test for loading image from files, saving to file, removing and
tagging images. These tests do not depend on docker or podman and can
use the container runtime in minikube.

Testing image commands without depending on docker or podman requires
dependency on an image inside minikube. We depend on the pause image
which is part of k8s. We know the image name but not the tag since we
may run different versions of k8s. Add findPauseImage() helper to
return the image name.

Testing requires dependency on minikube commands. Extract tagImage(),
removeImage(), saveImageToFile(), and loadImageFromFile() helpers.

We test in the following order:

1. Test image tag using the pause image, using `image rm` to clean up
   (new test).
2. Test image remove using the `image tag` to create a new image.
3. Test image save to file using the pause image.
4. Test image load from file by creating new image using `image tag`
   saving to file using `image save`, removing using `image rm`, and
   loading it from file using `image load`.

The modified tests do not use the global variables. Each test uses its
own image name and paths are in temporary test directory so they are
cleaned up automatically.

This change fixes 2 failing tests and add a new test.
2025-08-24 14:43:45 +03:00
Nir Soffer 4aea9a4267 test: Group related image tests
Group ImageSaveToDaemon with other Image*Daemon tests. Grouping related
tests make it easier to work with the code.
2025-08-23 21:16:23 +03:00
Nir Soffer 646794e917 test: Improve image list tests
Improve the image list tests to actually parsing the json and yaml
output and extract list of image names. The ensures that the expected
images names exist in minikube.

Previously we looked up the image names in rr.Output() is a multiple
formatted message including additional text and contents of stdout and
stderr. Using it for searching images can return the wrong result.
2025-08-23 21:16:21 +03:00
Nir Soffer b2acf957d7 test: Inline unneeded helper
tagAndLoadDaemon was called once from function doing nothing else.
Inline it in the caller.
2025-08-23 21:12:54 +03:00
Nir Soffer 7affa76cc5 test: Unify test names
Add load and save tests use ToFile, ToDaemon, FromFile, FromDaemon
suffix.
2025-08-23 21:12:54 +03:00
Nir Soffer ac378f46f5 test: Improve image list checks
We had similar code to check if image exists or not. Add
checkImageNotExists() helper and refactor listImages() helper to make it
easier to use.

listImages() fails the test so the caller do no not need to check for
errors. It returns list of images so the caller does not have to parse
the output.

When parsing the output of `minikube image ls` use scanner to split the
output to lines. Previously we search images in rr.Output() (formatted
message with contents of stdout and stderr) instead of
rr.Stdout.String(), which could lead to returning a wrong result.
2025-08-23 21:12:54 +03:00
Nir Soffer 65ef5bd2c4 test: Usse kickbase/echo-server for service tests
The echoserver-arm:1.8 image is not an arm64 image:

    % kubectl create deployment echoserver --image registry.k8s.io/echoserver-arm:1.8
    deployment.apps/echoserver created

    % kubectl logs deploy/echoserver
    exec /usr/sbin/nginx: exec format error

    % minikube ssh -- sudo nerdctl -n k8s.io image ls registry.k8s.io/echoserver-arm:1.8
    REPOSITORY                        TAG    IMAGE ID        CREATED               PLATFORM       SIZE        BLOB SIZE
    registry.k8s.io/echoserver-arm    1.8    b33d4cdf6ed0    About a minute ago    linux/amd64    90.1 MiB    43.2 MiB

Replace with kickbase/echo-server we used in other tests.

With this change ServerCmdConnect pass. The other test using the broken
arm image was not failing, maybe it was not checking the deployment
status properly.

Functional tests time reduced from 230 seconds to 200 seconds:

    --- FAIL: TestFunctional (200.87s)
2025-08-22 19:46:16 -07:00
Nir Soffer cb07147efe test: Add contants_test file
Currently keeping one constant for kickbase/echo-server used in the
image tests. We want to use this in other tests.
2025-08-22 19:46:16 -07:00
Medya Ghazizadeh 95fc5e5478
CI: major refactor for functional tests in github actions (#21290)
* add matrixfying

* ensure matrix jobs run after build binaries job

* use echo instead of helper

* setup-go needs go version

* make binaries executables

* chmod +x for test binaries

* install conntrack and socat for baremetal

* cancel preivous commits jobs in favor of latest job

* limit to 7 digits of sha for gopogh file

* echo gopogh url

* add run id to gopogh filename

* fix indent

* rename to build-test-binaries

* list skipped files too

* kubectl test better

* use short run id

* imrove error tet

* download kubectl to a tmp folder and remove leftover

* produce job summary

* fix names

* better results summary

* publish gopogh url in summary

* format better

* wordings

* add a new job unit test

* comment

* unit test script mkdir for coverage folder for widnows

* try to fix unit test for windows

* dont fix windows tests in this PR

* add lint job

* fix name

* separate boilerplate and add go modtidy

* install libvirt for lint

* name

* go mod tidy

* dont repeat name functional twice

* rename step

* fix comment

* fix run id

* delete debug

* adjust timeouts and treat 0 pass as failure icon

* rename job

* fix name
2025-08-12 02:24:28 -07:00
Nir Soffer 62529ec03e
spelling: Fix spelling errors with codespell (#21273)
Fix trivial spelling errors using codespell[1]:

    codespell --skip '*.yaml,*.tmpl,*.json,*.html,*.patch,go.sum' -w

And rejecting some false positives fixes:

    ./CHANGELOG.md:907: fliter ==> filter
    ./third_party/go9p/clnt_write.go:48: Writen ==> Written
    ./third_party/kubeadm/app/features/features.go:69: AtLeast ==> at least
    ./site/content/en/docs/contrib/translations.md:106: certificats ==> certificates
    ./site/content/en/docs/contrib/translations.md:113: espace ==> escape
    ./site/content/en/docs/tutorials/amd.md:75: HSA ==> HAS
    ./site/content/en/docs/tutorials/amd.md:87: HSA ==> HAS
    ./pkg/minikube/config/extra_options_test.go:143: expRes ==> express
    ./pkg/minikube/config/extra_options_test.go:151: expRes ==> express
    ./pkg/minikube/config/extra_options_test.go:152: expRes ==> express
    ./pkg/minikube/config/extra_options_test.go:168: expRes ==> express
    ./pkg/minikube/config/extra_options_test.go:177: expRes ==> express
    ./pkg/minikube/config/extra_options_test.go:178: expRes ==> express

There are more spelling errors that need manual selection:

    ./CHANGELOG.md:234: issuse ==> issue, issues
    ./CHANGELOG.md:543: Pris ==> Prise, Prism
    ./hack/benchmark/time-to-k8s/page.go:73: readin ==> reading, read in
    ./hack/benchmark/image-build/generate-chart.go:82: INTERATIVE ==> INTERACTIVE, ITERATIVE
    ./hack/benchmark/image-build/generate-chart.go:87: INTERATIVE ==> INTERACTIVE, ITERATIVE
    ./hack/benchmark/image-build/generate-chart.go:137: INTERATIVE ==> INTERACTIVE, ITERATIVE
    ./hack/benchmark/image-build/generate-chart.go:162: interative ==> interactive, iterative
    ./hack/benchmark/image-build/generate-chart.go:195: INTERATIVE ==> INTERACTIVE, ITERATIVE
    ./third_party/go9p/fmt.go:132: Tread ==> Thread, Treat
    ./third_party/go9p/fmt.go:133: Tread ==> Thread, Treat
    ./third_party/go9p/p9.go:33: Tread ==> Thread, Treat
    ./third_party/go9p/p9.go:170: Tread ==> Thread, Treat
    ./third_party/go9p/p9.go:171: Tread ==> Thread, Treat
    ./third_party/go9p/p9.go:225: Tread ==> Thread, Treat
    ./third_party/go9p/p9.go:263: Tread ==> Thread, Treat
    ./third_party/go9p/packt.go:165: Tread ==> Thread, Treat
    ./third_party/go9p/packt.go:168: Tread ==> Thread, Treat
    ./third_party/go9p/srv_srv.go:305: Tread ==> Thread, Treat
    ./third_party/go9p/srv_srv.go:349: Tread ==> Thread, Treat
    ./third_party/go9p/unpack.go:170: Tread ==> Thread, Treat
    ./site/content/en/docs/tutorials/multi_control_plane_ha_clusters.md:145: Virual ==> Virtual, Visual, Viral
    ./pkg/drivers/krunkit/krunkit.go:392: Terminte ==> Terminate, Termite
    ./pkg/drivers/common/common.go:283: drawin ==> drawing, draw in, drawn
    ./pkg/drivers/kic/oci/oci.go:175: stroed ==> stored, stroked, strode
    ./pkg/minikube/out/out.go:412: isT ==> is, it, its, it's, sit, list
    ./pkg/minikube/out/out.go:413: isT ==> is, it, its, it's, sit, list
    ./pkg/minikube/out/out.go:414: isT ==> is, it, its, it's, sit, list
    ./pkg/minikube/shell/shell_test.go:152: writed ==> wrote, written, write, writer
    ./pkg/minikube/bootstrapper/kubeadm/kubeadm.go:710: wil ==> will, well

If we find a way to prevent the false positives we can use this command
for spell checking in the CI.

[1] https://github.com/codespell-project/codespell
2025-08-11 11:27:20 -07:00
Victor Ubahakwe 958ecac9d3
Refactor table rendering (#20893)
* Refactored table rendering codes to support updated tablewriter v1.0.7

This commit makes all necessary code changes to maintain compatibility
with the new tablewriter version. The update includes several required modifications across multiple files.

Files modified:
- cmd/minikube/cmd/config/images.go
- cmd/minikube/cmd/config/addons_list.go
- cmd/minikube/cmd/config/profile_list.go
- hack/benchmark/time-to-k8s/chart.go
- hack/benchmark/time-to-k8s/cpu.go
- pkg/minikube/audit/row.go
- pkg/minikube/machine/cache_images.go
- pkg/minikube/perf/result_manager.go
- pkg/minikube/service/service.go

Now #20878 can be merged.
Addresses #20879

* The tablewriter package v1.0.7 renamed SetHeaders to SetHeader

* updated go mod and table.SetColumnAlignment([]int{0, 0, 0, 0})

* Changed syntax and added vendor to gitignore

* simplified version of tablewriter

* removed vendor

* fix addon_list

* fix images tablewrtier

* bump tablewriter for profile list

* go mod tidy

* bump tablewriter for chart

* bump tablewriter for cpu chart

* bump tablewriter for row

* bump tablewriter cache images

* bump tablewriter

* bump tablewriter

* revert file

* bump tablewritter

* fix unit test

* fix lint issues

* fix the integration test pipe char

* convert all tables to new pipe instead of asci pipe

* convert all tables to new pipe instead of asci pipe

* go mod tidy

* go work sync

---------

Co-authored-by: Medya Ghazizadeh <medya@google.com>
2025-07-21 16:20:55 -07:00
Predrag Rogic 4da3cedc84
Fix KVM driver (tests) timeouts (#20852)
* Fix KVM driver tests timeouts

Rewrite KVM driver waiting logic for domain start, getting ip address
and shutting domain down. Add more config/state outputs to aid future
debugging.

Bump go/libvirt to v1.11002.0 and set the minimum memory required for
running all tests to 3GB to avoid some really weird system behaviour.

* revert reduction of timelimit for TestCert tests run

* set memory and debug output in TestNoKubernetes tests

* extend kvm waitForStaticIP timeout

* add console log to debug output

* Updating ISO to v1.36.0-1748823857-20852

---------

Co-authored-by: minikube-bot <minikube-bot@google.com>
2025-06-03 15:07:48 -07:00
錦南路之花 abdbc5b3a3 Apply suggestions from code review
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
2025-01-28 11:42:51 -08:00
锦南路之花 3c42f1ce99 fix: fix incomplete cleanup in tunnel.json and zombie process in functional test 2025-01-28 11:42:51 -08:00
锦南路之花 1edaec55f4 test: allow running functional tests for different k8s versions 2025-01-28 11:42:51 -08:00
锦南路之花 ab81991ff6 fix: fix empty tarball when generating image save 2024-08-07 14:38:22 -07:00
Medya Gh 02a76e0c47 add docker.io to image 2024-07-11 14:34:39 -07:00
Medya Gh e2fb616836 fix tag 2024-07-11 14:34:39 -07:00
Medya Gh 041c86d464 use docker hub image 2024-07-11 14:34:39 -07:00
Medya Gh dbcd1a974e fix image tag 2024-07-11 14:34:39 -07:00
Medya Gh ca6443540a add warning when loading image with wrong arch 2024-07-11 14:34:39 -07:00
Predrag Rogic 6f4d0f1f3b
Merge branch 'kubernetes:master' into ha 2024-03-03 18:57:51 +00:00
Steven Powell 4d32230e3e fix lint errors 2024-02-12 17:32:14 -08:00
Predrag Rogic 86e00e66d7
Merge branch 'kubernetes:master' into ha 2024-01-31 01:38:28 +00:00
Steven Powell fc27285b44 add success message if log file path provided 2024-01-19 16:26:24 -08:00
Predrag Rogic ad7fb3992c
support kubernetes ha cluster topology in minikube 2024-01-07 21:36:17 +00:00
Martin Jirku cd1af85eb0
minikube cp will create nonexisten directory instead of fail
Signed-off-by: Martin Jirku <martin@jirku.sk>
2023-12-02 22:01:32 +01:00
Medya Ghazizadeh d8422bf5d7
Merge pull request #16416 from marcellmartini/feature/issue-16415
Feature: Make kubeadm.applyNodeLabels apply label to all nodes
2023-11-29 12:02:29 -08:00
Товарищ программист ec9c259df3
Update test/integration/functional_test.go
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
2023-06-10 21:43:54 +08:00
Товарищ программист dbbed77623
Update test/integration/functional_test.go
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
2023-06-07 23:09:30 +08:00
Товарищ программист 55868b1736 fix: quit minikube service when there is no available pods 2023-06-05 16:16:02 -07:00
Steven Powell 5b63431c6d fix ImageLoadFromFile reporting false failures 2023-05-15 12:22:11 -07:00
Steven Powell 9a4aed37ca add --alsologtostderr to functional images tests 2023-05-15 10:54:37 -07:00
Marcell Martini c6393b84fb Add on expectedLabels a missing label. 2023-05-09 14:40:39 -04:00
Steven Powell 8f47b1d25b update pause image 2023-03-30 10:35:53 -07:00
Steven Powell 44c4657e4f remove remaining references to k8s.gcr.io 2023-03-30 09:45:52 -07:00
Steven Powell 50e9147e4e fix lint errors 2023-03-20 12:43:07 -07:00
Steven Powell cd9509644a increase timeout for Windows 2023-03-03 13:15:55 -08:00
Steven Powell ed78682de9 fix ServiceCmd/Format test 2023-03-03 10:01:30 -08:00
Steven Powell 3dd2006de7 typo in comment 2023-03-03 07:50:05 -08:00
Steven Powell f98fd5d636 fix ServiceCmd test failing on Windows 2023-03-03 07:39:17 -08:00
Steven Powell 2895fc1b4a tests: Split up ServiceCmd test into sub-tests 2023-03-02 13:10:38 -08:00
Om Saran 00d5b2acc5 Update test name, logging and generate docs 2023-02-20 09:52:03 -06:00
Om Saran 2057e1d3ad Fix service cmd functional test to give by passing correct profile 2023-02-15 21:18:26 -06:00
Om Saran e33b5af7b7 Add integration test and fix behvaior on wrong output format for service list 2023-02-15 15:44:48 -06:00
Steven Powell f19b19803b remove license file after test 2022-11-18 09:14:33 -08:00