mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ee4bd806ba
This fix tries to fix the discrepancy between API and CLI on hostname validation. Previously, the hostname validation was handled at the CLI interface in runconfig/opts/parse.go and return an error if the hostname is invalid. However, if an end user use the remote API to pass the hostname, the error will not be returned immediately. Instead the error will only be thrown out when the container creation fails. This creates behavior discrepancy between API and CLI. In this fix, the hostname validation was moved to verifyContainerSettings so the behavior will be the same for API and CLI. After the change, since CLI does not handle the hostname validation any more, the previous unit tests about hostname validation on CLI in runconfig/opts/parse_test.go has to be updated as well because there is no validation at this stage. All those unit tests are moved to integration test TestRunTooLongHostname so that the hostname validation is still properly covered as before. Note: Since the hostname validation moved to API, the error message changes from `invalid hostname format for --hostname:` to `invalid hostname format:` as well because `--hostname` is passed to CLI only. This fix fixes #21595. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> |
||
---|---|---|
.. | ||
fixtures | ||
opts | ||
compare.go | ||
compare_test.go | ||
config.go | ||
config_test.go | ||
config_unix.go | ||
config_windows.go | ||
errors.go | ||
hostconfig.go | ||
hostconfig_test.go | ||
hostconfig_unix.go | ||
hostconfig_windows.go | ||
streams.go |