|
@@ -1,12 +1,14 @@
|
|
package parser
|
|
package parser
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "bufio"
|
|
"bytes"
|
|
"bytes"
|
|
"fmt"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"runtime"
|
|
"runtime"
|
|
|
|
+ "strings"
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/assert"
|
|
@@ -159,3 +161,14 @@ RUN indented \
|
|
assert.Contains(t, warnings[1], "RUN another thing")
|
|
assert.Contains(t, warnings[1], "RUN another thing")
|
|
assert.Contains(t, warnings[2], "will become errors in a future release")
|
|
assert.Contains(t, warnings[2], "will become errors in a future release")
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func TestParseReturnsScannerErrors(t *testing.T) {
|
|
|
|
+ label := strings.Repeat("a", bufio.MaxScanTokenSize)
|
|
|
|
+
|
|
|
|
+ dockerfile := strings.NewReader(fmt.Sprintf(`
|
|
|
|
+ FROM image
|
|
|
|
+ LABEL test=%s
|
|
|
|
+`, label))
|
|
|
|
+ _, err := Parse(dockerfile)
|
|
|
|
+ assert.EqualError(t, err, "dockerfile line greater than max allowed size of 65535")
|
|
|
|
+}
|