mirror of
https://github.com/moby/moby.git
synced 2026-08-09 17:39:58 +00:00
This test was testing errors produced by runc; both the "maximum" and "minimum" values originate from the OCI runtime;d48d9cfefc/libcontainer/cgroups/fs/cpu.go (L66-L83)docker run --cpu-shares=1 alpine docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: the minimum allowed cpu-shares is 2: unknown. Happy path for this setting is covered by TestRunWithCPUShares, and various other tests, so we validate that the options take effect;f5af46d4d5/integration-cli/docker_cli_run_unix_test.go (L494-L503)This patch: - removes the test and migrates it to an integration test - removes the checks for errors that might be produced by runc - updates our validation for invalid (negative) values to happen when creating the contaienr; the existing check that happened when creating the OCI spec is preserved, so that configs of existing containers are still validated. - updates validateResources to return the correct error-type - updated unit-test to validate With this patch: make TEST_FILTER='TestCreateInvalidHostConfig' TEST_SKIP_INTEGRATION_CLI=1 test-integration --- PASS: TestCreateInvalidHostConfig (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_IpcMode (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_CPUShares (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_PidMode (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_PidMode_without_container_ID (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_Annotations (0.00s) --- PASS: TestCreateInvalidHostConfig/invalid_UTSMode (0.00s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>