Skip to content

[WIP] cleanup container validation#38676

Closed
thaJeztah wants to merge 5 commits intomoby:masterfrom
thaJeztah:cleanup_version_checks
Closed

[WIP] cleanup container validation#38676
thaJeztah wants to merge 5 commits intomoby:masterfrom
thaJeztah:cleanup_version_checks

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Feb 3, 2019

Refactor some validation code to move fixMemorySwappiness() elsewhere than buried deep in the daemon validation, whereas it's actually use converting API requests to actual values so (I think) should be handled somewhere in the API, or at least earlier in the steps..

@codecov
Copy link

codecov bot commented Feb 3, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@618be06). Click here to learn what that means.
The diff coverage is 51.51%.

@@            Coverage Diff            @@
##             master   #38676   +/-   ##
=========================================
  Coverage          ?   36.52%           
=========================================
  Files             ?      610           
  Lines             ?    45242           
  Branches          ?        0           
=========================================
  Hits              ?    16524           
  Misses            ?    26445           
  Partials          ?     2273

@thaJeztah
Copy link
Member Author

Removed fixMemorySwappiness 🤞

@thaJeztah thaJeztah force-pushed the cleanup_version_checks branch from 743d2ea to fcf5b43 Compare February 3, 2019 22:25
@thaJeztah thaJeztah changed the title [WIP] cleanup container validation cleanup container validation Feb 3, 2019
@thaJeztah
Copy link
Member Author

Okay, these are genuine (some work to do still); https://jenkins.dockerproject.org/job/Docker-PRs-powerpc/13230/console

Also interesting; looks like those tests run exactly the same command, so perhaps there's a bug in those tests as well

23:44:18 FAIL: docker_cli_update_unix_test.go:202: DockerSuite.TestUpdateInvalidSwapMemory
23:44:18 
23:44:18 assertion failed: 
23:44:18 Command:  /usr/local/cli/docker update --memory-swap 600M test-update-container
23:44:18 ExitCode: 1
23:44:18 Error:    exit status 1
23:44:18 Stdout:   
23:44:18 Stderr:   Error response from daemon: You should always set the Memory limit when using Memoryswap limit, see usage
23:44:18 
23:44:18 
23:44:18 Failures:
23:44:18 ExitCode was 1 expected 0
23:44:18 Expected no error

23:44:34 FAIL: docker_cli_update_unix_test.go:186: DockerSuite.TestUpdateSwapMemoryOnly
23:44:34 
23:44:34 assertion failed: 
23:44:34 Command:  /usr/local/cli/docker update --memory-swap 600M test-update-container
23:44:34 ExitCode: 1
23:44:34 Error:    exit status 1
23:44:34 Stdout:   
23:44:34 Stderr:   Error response from daemon: You should always set the Memory limit when using Memoryswap limit, see usage
23:44:34 
23:44:34 
23:44:34 Failures:
23:44:34 ExitCode was 1 expected 0
23:44:34 Expected no error
23:44:35 

and; we should have a different way of testing those validations (guess they are skipped on the other machines because they don't have swap enabled)

@thaJeztah thaJeztah changed the title cleanup container validation [WIP] cleanup container validation Feb 4, 2019
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Some container configurations are modified in adaptContainerSettings,
so validate them _after_ adjusting, instead validating settings that
are modified afterwards.

This can simplify validation, and perform validating invalid options
that were currently not validated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The config was only verified in a single case (containerCreate), and
nil was passed in all other occurences, so it made more sense to
explicitly verify them separate.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…fig"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
To unset memory-swapiness, the client sends `-1` as a
magic value. Previously this magic value was handled deep
inside the daemon validation logic, and an additional boolean
value was also in use to handle container updates.

Instead of sending the magic value to the daemon, handle this
value at the API layer (as it's effectively a convention used
by the API, but not an actual valid value for this field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the cleanup_version_checks branch from fcf5b43 to 9e16cd9 Compare July 16, 2019 22:24
@thaJeztah thaJeztah closed this Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants