提交 54c25d28 编写于 作者: D DCCooper

hack: enhancement of unit_test check

1. enhancement of unit test function
2. fix go test error
Signed-off-by: NDCCooper <1866858@gmail.com>
上级 611adc54
...@@ -212,7 +212,7 @@ RUN echo hello world ...@@ -212,7 +212,7 @@ RUN echo hello world
buildOpts.contextDir, _ = os.Getwd() buildOpts.contextDir, _ = os.Getwd()
buildOpts.file = tmpDir.Join(filename) buildOpts.file = tmpDir.Join(filename)
_, err := readDockerfile() _, _, err := readDockerfile()
assert.NilError(t, err) assert.NilError(t, err)
} }
...@@ -231,7 +231,7 @@ RUN echo hello world ...@@ -231,7 +231,7 @@ RUN echo hello world
buildOpts.contextDir = tmpDir.Path() buildOpts.contextDir = tmpDir.Path()
buildOpts.file = "testDockerfile" buildOpts.file = "testDockerfile"
_, err := readDockerfile() _, _, err := readDockerfile()
assert.NilError(t, err) assert.NilError(t, err)
} }
...@@ -250,7 +250,7 @@ RUN echo hello world ...@@ -250,7 +250,7 @@ RUN echo hello world
buildOpts.contextDir = tmpDir.Path() buildOpts.contextDir = tmpDir.Path()
buildOpts.file = "" buildOpts.file = ""
_, err := readDockerfile() _, _, err := readDockerfile()
assert.NilError(t, err) assert.NilError(t, err)
} }
...@@ -267,7 +267,7 @@ func TestReadDockerfileWithNoContent(t *testing.T) { ...@@ -267,7 +267,7 @@ func TestReadDockerfileWithNoContent(t *testing.T) {
buildOpts.contextDir = tmpDir.Path() buildOpts.contextDir = tmpDir.Path()
buildOpts.file = filename buildOpts.file = filename
_, err := readDockerfile() _, _, err := readDockerfile()
assert.ErrorContains(t, err, "file is empty") assert.ErrorContains(t, err, "file is empty")
} }
...@@ -278,7 +278,7 @@ func TestReadDockerfileWithDirectory(t *testing.T) { ...@@ -278,7 +278,7 @@ func TestReadDockerfileWithDirectory(t *testing.T) {
buildOpts.contextDir = "" buildOpts.contextDir = ""
buildOpts.file = "." buildOpts.file = "."
_, err := readDockerfile() _, _, err := readDockerfile()
assert.ErrorContains(t, err, "should be a regular file") assert.ErrorContains(t, err, "should be a regular file")
} }
......
...@@ -29,7 +29,7 @@ for path in $(go list ./...); do ...@@ -29,7 +29,7 @@ for path in $(go list ./...); do
echo "Start to test: ${path}" echo "Start to test: ${path}"
# TEST_ARGS is " -args SKIP_REG=foo", so no double quote for it # TEST_ARGS is " -args SKIP_REG=foo", so no double quote for it
go test -mod=vendor -cover -count=1 -timeout 300s -v "${path}" ${TEST_ARGS} >> "${testlog}" go test -mod=vendor -cover -count=1 -timeout 300s -v "${path}" ${TEST_ARGS} >> "${testlog}"
cat "${testlog}" | grep -E -- "--- FAIL:" cat "${testlog}" | grep -E -- "--- FAIL:|^FAIL"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Testing failed... Please check ${testlog}" echo "Testing failed... Please check ${testlog}"
exit 1 exit 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册