Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
relax curl logger tests for added opencensus header
  • Loading branch information
chingor13 committed Aug 28, 2019
commit 7d5ee76bdddd3abd6901d5db75e9d7a1243f7ebd
Original file line number Diff line number Diff line change
Expand Up @@ -1222,13 +1222,9 @@ public void testExecute_curlLogger() throws Exception {
for (String message : recorder.messages()) {
if (message.startsWith("curl")) {
found = true;
assertEquals(
"curl -v --compressed -H 'Accept-Encoding: gzip' -H 'User-Agent: "
+ "Google-HTTP-Java-Client/"
+ HttpRequest.VERSION
+ " (gzip)"
+ "' -- 'http://google.com/#q=a'\"'\"'b'\"'\"'c'",
message);
assert(message.contains("curl -v --compressed -H 'Accept-Encoding: gzip'"));
assert(message.contains("-H 'User-Agent: Google-HTTP-Java-Client/" + HttpRequest.VERSION + " (gzip)'"));
assert(message.contains("' -- 'http://google.com/#q=a'\"'\"'b'\"'\"'c'"));
}
}
assertTrue(found);
Expand All @@ -1253,16 +1249,13 @@ public void testExecute_curlLoggerWithContentEncoding() throws Exception {
.execute();

boolean found = false;
final String expectedCurlLog =
"curl -v --compressed -X POST -H 'Accept-Encoding: gzip' "
+ "-H 'User-Agent: "
+ HttpRequest.USER_AGENT_SUFFIX
+ "' -H 'Content-Type: text/plain; charset=UTF-8' -H 'Content-Encoding: gzip' "
+ "-d '@-' -- 'http://google.com/#q=a'\"'\"'b'\"'\"'c' << $$$";
for (String message : recorder.messages()) {
if (message.startsWith("curl")) {
found = true;
assertEquals(expectedCurlLog, message);
assert(message.contains("curl -v --compressed -X POST -H 'Accept-Encoding: gzip'"));
assert(message.contains("-H 'User-Agent: " + HttpRequest.USER_AGENT_SUFFIX + "'"));
assert(message.contains("-H 'Content-Type: text/plain; charset=UTF-8' -H 'Content-Encoding: gzip'"));
assert(message.contains("-d '@-' -- 'http://google.com/#q=a'\"'\"'b'\"'\"'c' << $$$"));
}
}
assertTrue(found);
Expand Down