瀏覽代碼

Verify the no-trunc option for the search operation.

Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Yuan Sun 10 年之前
父節點
當前提交
6e8aa4e588
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      integration-cli/docker_cli_search_test.go

+ 10 - 0
integration-cli/docker_cli_search_test.go

@@ -63,6 +63,16 @@ func (s *DockerSuite) TestSearchCmdOptions(c *check.C) {
 		c.Fatalf("failed to search on the central registry: %s, %v", outSearchCmd, err)
 	}
 
+	searchCmdNotrunc := exec.Command(dockerBinary, "search", "--no-trunc=true", "busybox")
+	outSearchCmdNotrunc, _, err := runCommandWithOutput(searchCmdNotrunc)
+	if err != nil {
+		c.Fatalf("failed to search on the central registry: %s, %v", outSearchCmdNotrunc, err)
+	}
+
+	if len(outSearchCmd) > len(outSearchCmdNotrunc) {
+		c.Fatalf("The no-trunc option can't take effect.")
+	}
+
 	searchCmdautomated := exec.Command(dockerBinary, "search", "--automated=true", "busybox")
 	outSearchCmdautomated, exitCode, err := runCommandWithOutput(searchCmdautomated) //The busybox is a busybox base image, not an AUTOMATED image.
 	if err != nil || exitCode != 0 {