-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 2b17f4c fixed the way empty labels are taken into account (i.e. not interpolated from environment variable), but it created a regression. `ValidateLabel` functions doesn't allow empty label value, but it has always been possible to pass an empty label via the cli (`docker run --label foo`). This fixes that by not validating the label flag. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
- Loading branch information
1 parent
ef7d8be
commit 31dc5c0
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package container | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/docker/cli/internal/test" | ||
"github.com/docker/docker/api/types/container" | ||
"github.com/docker/docker/api/types/network" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRunLabel(t *testing.T) { | ||
cli := test.NewFakeCli(&fakeClient{ | ||
createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ string) (container.ContainerCreateCreatedBody, error) { | ||
return container.ContainerCreateCreatedBody{ | ||
ID: "id", | ||
}, nil | ||
}, | ||
Version: "1.36", | ||
}) | ||
cmd := NewRunCommand(cli) | ||
cmd.Flags().Set("detach", "true") | ||
cmd.SetArgs([]string{"--label", "foo", "busybox"}) | ||
assert.NoError(t, cmd.Execute()) | ||
} |