You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add sub tests for parallel downloads with "with cache" and "caching-only
mode". The test run 20 concurrent downloads with the current test http
server and ensure that downloads succeeded.
To make it possible to test using the same process, we include now a
counter in the perProcessTempfile. The file name is now:
{filename}.pid.{count}
The test revealed an issue with clonefile, not seen when testing 3
parallel `limactl create`. When the data file is replaced during a
clonefile syscall, it may fail with:
clonefile failed: no such file or directory
This smells like a darwin bug, but we can avoid this issue by using the
first download result. When a download finishes, we check if data file
exists, and return success if it does. We take a lock for the very
short time needed to check and rename the temporary data file to the
target file.
The parallel tests failed on windows - it seems that os.Rename() does
not work on windows if the target exist. Replacing atomicWrite with a
simpler version that takes a lock and write the file fixes the issue.
Tested using:
% go test ./pkg/downloader -run 'TestDownloadRemote/with_cache/parallel' -count=1000
ok github.com/lima-vm/lima/pkg/downloader 116.025s
% go test ./pkg/downloader -run 'TestDownloadRemote/caching-only_mode/parallel' -count=1000
ok github.com/lima-vm/lima/pkg/downloader 98.535s
Signed-off-by: Nir Soffer <[email protected]>
0 commit comments