|
@@ -1,13 +1,11 @@
|
|
package service
|
|
package service
|
|
|
|
|
|
import (
|
|
import (
|
|
- "os"
|
|
|
|
"reflect"
|
|
"reflect"
|
|
"testing"
|
|
"testing"
|
|
"time"
|
|
"time"
|
|
|
|
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/api/types/container"
|
|
- "github.com/docker/docker/opts"
|
|
|
|
"github.com/docker/docker/pkg/testutil/assert"
|
|
"github.com/docker/docker/pkg/testutil/assert"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -106,47 +104,3 @@ func TestHealthCheckOptionsToHealthConfigConflict(t *testing.T) {
|
|
_, err := opt.toHealthConfig()
|
|
_, err := opt.toHealthConfig()
|
|
assert.Error(t, err, "--no-healthcheck conflicts with --health-* options")
|
|
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))
|
|
|
|
-}
|
|
|