浏览代码

Set `pullChanged` when setting `--pull` on `compose up`

Add e2e tests

Signed-off-by: Laura Brehm <[email protected]>
Laura Brehm 2 年之前
父节点
当前提交
a224780795
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. 1 0
      cmd/compose/up.go
  2. 15 0
      e2e/cucumber-features/up.feature

+ 1 - 0
cmd/compose/up.go

@@ -93,6 +93,7 @@ func upCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *cob
 		Use:   "up [OPTIONS] [SERVICE...]",
 		Use:   "up [OPTIONS] [SERVICE...]",
 		Short: "Create and start containers",
 		Short: "Create and start containers",
 		PreRunE: AdaptCmd(func(ctx context.Context, cmd *cobra.Command, args []string) error {
 		PreRunE: AdaptCmd(func(ctx context.Context, cmd *cobra.Command, args []string) error {
+			create.pullChanged = cmd.Flags().Changed("pull")
 			create.timeChanged = cmd.Flags().Changed("timeout")
 			create.timeChanged = cmd.Flags().Changed("timeout")
 			return validateFlags(&up, &create)
 			return validateFlags(&up, &create)
 		}),
 		}),

+ 15 - 0
e2e/cucumber-features/up.feature

@@ -0,0 +1,15 @@
+Feature: Up
+
+Background:
+    Given a compose file
+        """
+        services:
+          simple:
+            image: alpine
+            command: top
+        """
+
+Scenario: --pull always
+    When I run "compose up --pull=always -d"
+    Then the output contains "simple Pulled"
+