瀏覽代碼

Add more TestBuild Dockerfiles, especially for making sure manual RUN echo '#!...' continues to work correctly

Tianon Gravi 11 年之前
父節點
當前提交
c6dcee329d
共有 1 個文件被更改,包括 30 次插入0 次删除
  1. 30 0
      integration/buildfile_test.go

+ 30 - 0
integration/buildfile_test.go

@@ -132,11 +132,41 @@ run [ "$(cat /e)" = "blah" ]
 		[][2]string{{"/x", "hello"}, {"/", "blah"}},
 		[][2]string{{"/x", "hello"}, {"/", "blah"}},
 	},
 	},
 
 
+	// Comments, shebangs, and executability, oh my!
+	{
+		`
+FROM {IMAGE}
+# This is an ordinary comment.
+RUN { echo '#!/bin/sh'; echo 'echo hello world'; } > /hello.sh
+RUN [ ! -x /hello.sh ]
+RUN chmod +x /hello.sh
+RUN [ -x /hello.sh ]
+RUN [ "$(cat /hello.sh)" = $'#!/bin/sh\necho hello world' ]
+RUN [ "$(/hello.sh)" = "hello world" ]
+`,
+		nil,
+		nil,
+	},
+
+	// Environment variable
+	{
+		`
+from   {IMAGE}
+env    FOO BAR
+run    [ "$FOO" = "BAR" ]
+`,
+		nil,
+		nil,
+	},
+
+	// Environment overwriting
 	{
 	{
 		`
 		`
 from   {IMAGE}
 from   {IMAGE}
 env    FOO BAR
 env    FOO BAR
 run    [ "$FOO" = "BAR" ]
 run    [ "$FOO" = "BAR" ]
+env    FOO BAZ
+run    [ "$FOO" = "BAZ" ]
 `,
 `,
 		nil,
 		nil,
 		nil,
 		nil,