mirror of https://github.com/docker/cli.git
secrets: support simple syntax --secret foo
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
9074333957
commit
b3bbcc1ba6
|
@ -1,13 +1,11 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/testutil/assert"
|
||||
)
|
||||
|
||||
|
@ -106,47 +104,3 @@ func TestHealthCheckOptionsToHealthConfigConflict(t *testing.T) {
|
|||
_, err := opt.toHealthConfig()
|
||||
assert.Error(t, err, "--no-healthcheck conflicts with --health-* options")
|
||||
}
|
||||
|
||||
func TestSecretOptionsSimple(t *testing.T) {
|
||||
var opt opts.SecretOpt
|
||||
|
||||
testCase := "source=foo,target=testing"
|
||||
assert.NilError(t, opt.Set(testCase))
|
||||
|
||||
reqs := opt.Value()
|
||||
assert.Equal(t, len(reqs), 1)
|
||||
req := reqs[0]
|
||||
assert.Equal(t, req.Source, "foo")
|
||||
assert.Equal(t, req.Target, "testing")
|
||||
}
|
||||
|
||||
func TestSecretOptionsCustomUidGid(t *testing.T) {
|
||||
var opt opts.SecretOpt
|
||||
|
||||
testCase := "source=foo,target=testing,uid=1000,gid=1001"
|
||||
assert.NilError(t, opt.Set(testCase))
|
||||
|
||||
reqs := opt.Value()
|
||||
assert.Equal(t, len(reqs), 1)
|
||||
req := reqs[0]
|
||||
assert.Equal(t, req.Source, "foo")
|
||||
assert.Equal(t, req.Target, "testing")
|
||||
assert.Equal(t, req.UID, "1000")
|
||||
assert.Equal(t, req.GID, "1001")
|
||||
}
|
||||
|
||||
func TestSecretOptionsCustomMode(t *testing.T) {
|
||||
var opt opts.SecretOpt
|
||||
|
||||
testCase := "source=foo,target=testing,uid=1000,gid=1001,mode=0444"
|
||||
assert.NilError(t, opt.Set(testCase))
|
||||
|
||||
reqs := opt.Value()
|
||||
assert.Equal(t, len(reqs), 1)
|
||||
req := reqs[0]
|
||||
assert.Equal(t, req.Source, "foo")
|
||||
assert.Equal(t, req.Target, "testing")
|
||||
assert.Equal(t, req.UID, "1000")
|
||||
assert.Equal(t, req.GID, "1001")
|
||||
assert.Equal(t, req.Mode, os.FileMode(0444))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue