зеркало из https://github.com/microsoft/docker.git
Merge pull request #22505 from runcom/authz-load-import
integration-cli: test load/import with authz plugins
This commit is contained in:
Коммит
0d3d8d6416
|
@ -9,6 +9,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"bufio"
|
||||
|
@ -17,13 +18,14 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"net"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/pkg/authorization"
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
"github.com/docker/docker/pkg/plugins"
|
||||
"github.com/go-check/check"
|
||||
"net"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -415,6 +417,33 @@ func (s *DockerAuthzSuite) TestAuthZPluginEnsureNoDuplicatePluginRegistration(c
|
|||
c.Assert(s.ctrl.psResponseCnt, check.Equals, 1)
|
||||
}
|
||||
|
||||
func (s *DockerAuthzSuite) TestAuthZPluginEnsureLoadImportWorking(c *check.C) {
|
||||
c.Assert(s.d.Start("--authorization-plugin="+testAuthZPlugin, "--authorization-plugin="+testAuthZPlugin), check.IsNil)
|
||||
s.ctrl.reqRes.Allow = true
|
||||
s.ctrl.resRes.Allow = true
|
||||
c.Assert(s.d.LoadBusybox(), check.IsNil)
|
||||
|
||||
tmp, err := ioutil.TempDir("", "test-authz-load-import")
|
||||
c.Assert(err, check.IsNil)
|
||||
defer os.RemoveAll(tmp)
|
||||
|
||||
savedImagePath := filepath.Join(tmp, "save.tar")
|
||||
|
||||
out, err := s.d.Cmd("save", "-o", savedImagePath, "busybox")
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
out, err = s.d.Cmd("load", "--input", savedImagePath)
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
|
||||
exportedImagePath := filepath.Join(tmp, "export.tar")
|
||||
|
||||
out, err = s.d.Cmd("run", "-d", "--name", "testexport", "busybox")
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
out, err = s.d.Cmd("export", "-o", exportedImagePath, "testexport")
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
out, err = s.d.Cmd("import", exportedImagePath)
|
||||
c.Assert(err, check.IsNil, check.Commentf(out))
|
||||
}
|
||||
|
||||
// assertURIRecorded verifies that the given URI was sent and recorded in the authz plugin
|
||||
func assertURIRecorded(c *check.C, uris []string, uri string) {
|
||||
var found bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче