diff --git a/cli/command/container/completion_test.go b/cli/command/container/completion_test.go index 25ab31676f..b85aae32d5 100644 --- a/cli/command/container/completion_test.go +++ b/cli/command/container/completion_test.go @@ -4,6 +4,7 @@ import ( "strings" "testing" + "github.com/moby/sys/signal" "github.com/spf13/cobra" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -19,3 +20,17 @@ func TestCompleteLinuxCapabilityNames(t *testing.T) { assert.Check(t, is.Equal(name, strings.ToUpper(name)), "Should be formatted uppercase") } } + +func TestCompleteRestartPolicies(t *testing.T) { + values, directives := completeRestartPolicies(nil, nil, "") + assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion") + expected := restartPolicies + assert.Check(t, is.DeepEqual(values, expected)) +} + +func TestCompleteSignals(t *testing.T) { + values, directives := completeSignals(nil, nil, "") + assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion") + assert.Check(t, len(values) > 1) + assert.Check(t, is.Len(values, len(signal.SignalMap))) +}