Skip to content

Commit bb5799e

Browse files
committed
Make error tests independent of exact stack trace length
1 parent 1d0037a commit bb5799e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/test/php/com/amazon/aws/lambda/unittest/BufferedTest.class.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ public function error() {
5050
throw new IllegalStateException('Test');
5151
});
5252

53+
$headersAt= strpos($response, "\r\n\r\n") + 4;
5354
Assert::equals(
5455
"POST /2018-06-01/runtime/invocation/3e1afeb0-cde4-1d0e-c3c0-66b15046bb88/error HTTP/1.1\r\n".
5556
"Connection: close\r\n".
5657
"Host: test\r\n".
5758
"Content-Type: application/json\r\n".
58-
"Content-Length: 836\r\n".
59+
"Content-Length: ".(strlen($response) - $headersAt)."\r\n".
5960
"\r\n",
60-
substr($response, 0, strpos($response, "\r\n\r\n") + 4)
61+
substr($response, 0, $headersAt)
6162
);
6263
}
6364
}

src/test/php/com/amazon/aws/lambda/unittest/StreamingTest.class.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ public function reports_exceptions_before_streaming_via_error() {
5050
throw new IllegalStateException('Test');
5151
});
5252

53+
$headersAt= strpos($response, "\r\n\r\n") + 4;
5354
Assert::equals(
5455
"POST /2018-06-01/runtime/invocation/3e1afeb0-cde4-1d0e-c3c0-66b15046bb88/error HTTP/1.1\r\n".
5556
"Connection: close\r\n".
5657
"Host: test\r\n".
5758
"Content-Type: application/json\r\n".
58-
"Content-Length: 882\r\n".
59+
"Content-Length: ".(strlen($response) - $headersAt)."\r\n".
5960
"\r\n",
60-
substr($response, 0, strpos($response, "\r\n\r\n") + 4)
61+
substr($response, 0, $headersAt)
6162
);
6263
}
6364

0 commit comments

Comments
 (0)