mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
Add build integration cli tests
Clean up tests to remove duplicate code Add tests which run pull and create in an isolated configuration directory. Add build test for untrusted tag Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
@@ -5328,3 +5328,48 @@ func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) {
|
||||
c.Fatalf("RUN doesn't have the correct output:\nGot:%s\nExpected:%s", out, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerTrustSuite) TestTrustedBuild(c *check.C) {
|
||||
repoName := s.setupTrustedImage(c, "trusted-build")
|
||||
dockerFile := fmt.Sprintf(`
|
||||
FROM %s
|
||||
RUN []
|
||||
`, repoName)
|
||||
|
||||
name := "testtrustedbuild"
|
||||
|
||||
buildCmd := buildImageCmd(name, dockerFile, true)
|
||||
s.trustedCmd(buildCmd)
|
||||
out, _, err := runCommandWithOutput(buildCmd)
|
||||
if err != nil {
|
||||
c.Fatalf("Error running trusted build: %s\n%s", err, out)
|
||||
}
|
||||
|
||||
if !strings.Contains(out, fmt.Sprintf("FROM %s@sha", repoName[:len(repoName)-7])) {
|
||||
c.Fatalf("Unexpected output on trusted build:\n%s", out)
|
||||
}
|
||||
|
||||
// Build command does not create untrusted tag
|
||||
//dockerCmd(c, "rmi", repoName)
|
||||
}
|
||||
|
||||
func (s *DockerTrustSuite) TestTrustedBuildUntrustedTag(c *check.C) {
|
||||
repoName := fmt.Sprintf("%v/dockercli/build-untrusted-tag:latest", privateRegistryURL)
|
||||
dockerFile := fmt.Sprintf(`
|
||||
FROM %s
|
||||
RUN []
|
||||
`, repoName)
|
||||
|
||||
name := "testtrustedbuilduntrustedtag"
|
||||
|
||||
buildCmd := buildImageCmd(name, dockerFile, true)
|
||||
s.trustedCmd(buildCmd)
|
||||
out, _, err := runCommandWithOutput(buildCmd)
|
||||
if err == nil {
|
||||
c.Fatalf("Expected error on trusted build with untrusted tag: %s\n%s", err, out)
|
||||
}
|
||||
|
||||
if !strings.Contains(out, fmt.Sprintf("no trust data available")) {
|
||||
c.Fatalf("Unexpected output on trusted build with untrusted tag:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user