Signed-off-by: Sergii Kabashniuk <skabashnyuk@codenvy.com>
| ... | ... |
@@ -151,6 +151,26 @@ func TestInspectResponseEmptyContentType(t *testing.T) {
|
| 151 | 151 |
} |
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 |
+func TestUnknownContentLength(t *testing.T) {
|
|
| 155 |
+ content := []byte(dockerfileContents) |
|
| 156 |
+ ct := "text/plain" |
|
| 157 |
+ br := ioutil.NopCloser(bytes.NewReader(content)) |
|
| 158 |
+ contentType, bReader, err := inspectResponse(ct, br, -1) |
|
| 159 |
+ if err != nil {
|
|
| 160 |
+ t.Fatal(err) |
|
| 161 |
+ } |
|
| 162 |
+ if contentType != "text/plain" {
|
|
| 163 |
+ t.Fatalf("Content type should be 'text/plain' but is %q", contentType)
|
|
| 164 |
+ } |
|
| 165 |
+ body, err := ioutil.ReadAll(bReader) |
|
| 166 |
+ if err != nil {
|
|
| 167 |
+ t.Fatal(err) |
|
| 168 |
+ } |
|
| 169 |
+ if string(body) != dockerfileContents {
|
|
| 170 |
+ t.Fatalf("Corrupted response body %s", body)
|
|
| 171 |
+ } |
|
| 172 |
+} |
|
| 173 |
+ |
|
| 154 | 174 |
func TestMakeRemoteContext(t *testing.T) {
|
| 155 | 175 |
contextDir, cleanup := createTestTempDir(t, "", "builder-tarsum-test") |
| 156 | 176 |
defer cleanup() |