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)
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)
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.
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.
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.
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)
* 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
* 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>
* 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>