Compare commits

...

3 Commits

Author SHA1 Message Date
MicahKimel 75619555fb
Merge dd8059925e into a4619f3676 2024-09-17 11:17:56 +01:00
MicahKimel dd8059925e
Merge remote-tracking branch 'upstream/master' 2024-06-19 12:47:28 -04:00
MicahKimel 7098aaf6fc
Add test parse env formatted badly with spaces
fix container_run.md spacing

Signed-off-by: MicahKimel <micah.kimel@my.wheaton.edu>
2024-06-19 12:44:43 -04:00
2 changed files with 21 additions and 2 deletions

View File

@ -963,7 +963,7 @@ This starts an `ubuntu` container with access to the specified CDI device,
- A valid CDI specification (JSON or YAML file) for the requested device is
available on the system running the daemon, in one of the configured CDI
specification directories.
- The CDI feature has been enabled in the daemon; see [Enable CDI
- The CDI feature has been enabled in the daemon. See [Enable CDI
devices](https://docs.docker.com/reference/cli/dockerd/#enable-cdi-devices).
### <a name="attach"></a> Attach to STDIN/STDOUT/STDERR (-a, --attach)
@ -1572,4 +1572,4 @@ The `docker run` command is equivalent to the following API calls:
- If that call returns a 404 (image not found), and depending on the `--pull` option ("always", "missing", "never") the call can trigger a `docker pull <image>`.
- `/containers/create` again after pulling the image.
- `/containers/(id)/start` to start the container.
- `/containers/(id)/attach` to attach to the container when starting with the `-it` flags for interactive containers.
- `/containers/(id)/attach` to attach to the container when starting with the `-it` flags for interactive containers.

View File

@ -87,6 +87,25 @@ func TestParseEnvFileNonExistentFile(t *testing.T) {
}
}
// Test TestParseEnvFile for a badly formatted header
func TestParseEnvFileFormattedWithSpace(t *testing.T) {
content := `
[config 1]
foo=bar
f=quux
`
tmpFile := tmpFileWithContent(t, content)
_, err := ParseEnvFile(tmpFile)
if _, ok := err.(ErrBadKey); !ok {
t.Fatalf("Expected an ErrBadKey, got [%v]", err)
}
expectedMessage := "poorly formatted environment: variable '[config 1]' contains whitespaces"
if err.Error() != expectedMessage {
t.Fatalf("Expected [%v], got [%v]", expectedMessage, err.Error())
}
}
// Test ParseEnvFile for a badly formatted file
func TestParseEnvFileBadlyFormattedFile(t *testing.T) {
content := `foo=bar