-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(agent): update Guzzle 6 test cases and add Guzzle 7 test cases
- Loading branch information
Showing
12 changed files
with
616 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Test that CAT works with guzzle 7. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
if (version_compare(phpversion(), '7.2.0', '<=')) { | ||
die("skip: PHP > 7.2.0 required\n"); | ||
} | ||
if (!unpack_guzzle(7)) { | ||
die("skip: guzzle 7 installation required\n"); | ||
} | ||
if (!isset($_ENV["ACCOUNT_supportability"]) || !isset($_ENV["APP_supportability"])) { | ||
die("skip: env vars required"); | ||
} | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled=0 | ||
newrelic.cross_application_tracer.enabled = true | ||
*/ | ||
|
||
/*EXPECT | ||
tracing endpoint reached | ||
tracing endpoint reached | ||
Customer-Header=found tracing endpoint reached | ||
*/ | ||
|
||
/*EXPECT_RESPONSE_HEADERS | ||
X-NewRelic-App-Data=?? | ||
X-NewRelic-App-Data=?? | ||
X-NewRelic-App-Data=?? | ||
*/ | ||
|
||
/*EXPECT_METRICS | ||
[ | ||
"?? agent run id", | ||
"?? timeframe start", | ||
"?? timeframe stop", | ||
[ | ||
[{"name":"External/127.0.0.1/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/allOther"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"ExternalApp/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/all"}, | ||
[3, "??", "??", "??", "??", "??"]], | ||
[{"name":"ExternalTransaction/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/WebTransaction/Custom/tracing"}, | ||
[3, "??", "??", "??", "??", "??"]], | ||
[{"name":"ExternalTransaction/127.0.0.1/ENV[ACCOUNT_supportability]#ENV[APP_supportability]/WebTransaction/Custom/tracing", | ||
"scope":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/library/Guzzle 4-5/detected"}, | ||
[2, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/library/Guzzle 7/detected"}, [1, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, | ||
[3, 0, 0, 0, 0, 0]] | ||
] | ||
] | ||
*/ | ||
|
||
?> | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/config.php'); | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
require_guzzle(7); | ||
|
||
/* Create URL. */ | ||
$url = "http://" . make_tracing_url(realpath(dirname(__FILE__)) . '/../../../include/tracing_endpoint.php'); | ||
|
||
/* Use guzzle 7 to make an http request. */ | ||
use GuzzleHttp\Client; | ||
|
||
$client = new Client(); | ||
$response = $client->get($url); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap']]); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap', | ||
CUSTOMER_HEADER => 'zap']]); | ||
echo $response->getBody(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Test that Distributed Tracing works with guzzle 7. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
if (version_compare(phpversion(), '7.2.0', '<=')) { | ||
die("skip: PHP > 7.2.0 required\n"); | ||
} | ||
if (!unpack_guzzle(7)) { | ||
die("skip: guzzle 7 installation required\n"); | ||
} | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled = true | ||
newrelic.cross_application_tracer.enabled = false | ||
*/ | ||
|
||
/*EXPECT | ||
traceparent=found tracestate=found newrelic=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing tracing endpoint reached | ||
traceparent=found tracestate=found newrelic=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing tracing endpoint reached | ||
traceparent=found tracestate=found newrelic=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing Customer-Header=found tracing endpoint reached | ||
*/ | ||
|
||
/*EXPECT_RESPONSE_HEADERS | ||
*/ | ||
|
||
/*EXPECT_METRICS | ||
[ | ||
"?? agent run id", | ||
"?? timeframe start", | ||
"?? timeframe stop", | ||
[ | ||
[{"name":"External/127.0.0.1/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/127.0.0.1/all", | ||
"scope":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/allOther"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/library/Guzzle 4-5/detected"}, | ||
[2, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/library/Guzzle 7/detected"}, [1, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, | ||
[3, 0, 0, 0, 0, 0]], | ||
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, | ||
[1, "??", "??", "??", "??", "??"]], | ||
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, | ||
[1, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/TraceContext/Create/Success"}, | ||
[3, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/DistributedTrace/CreatePayload/Success"}, | ||
[3, "??", "??", "??", "??", "??"]] | ||
] | ||
] | ||
*/ | ||
|
||
?> | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/config.php'); | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
require_guzzle(7); | ||
|
||
/* Create URL. */ | ||
$url = "http://" . make_tracing_url(realpath(dirname(__FILE__)) . '/../../../include/tracing_endpoint.php'); | ||
//echo "\n"; | ||
//echo $url."\n"; | ||
|
||
/* Use guzzle 7 to make an http request. */ | ||
use GuzzleHttp\Client; | ||
|
||
$client = new Client(); | ||
$response = $client->get($url); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap']]); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap', | ||
CUSTOMER_HEADER => 'zap']]); | ||
echo $response->getBody(); |
95 changes: 95 additions & 0 deletions
95
tests/integration/external/guzzle7/test_dt_newrelic_header_disabled.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Test that DT works with guzzle 7. | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
if (version_compare(phpversion(), '7.2.0', '<=')) { | ||
die("skip: PHP > 7.2.0 required\n"); | ||
} | ||
if (!unpack_guzzle(7)) { | ||
die("skip: guzzle 7 installation required\n"); | ||
} | ||
*/ | ||
|
||
/*INI | ||
newrelic.distributed_tracing_enabled = true | ||
newrelic.cross_application_tracer.enabled = false | ||
newrelic.distributed_tracing_exclude_newrelic_header = true | ||
*/ | ||
|
||
/*EXPECT | ||
traceparent=found tracestate=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing tracing endpoint reached | ||
traceparent=found tracestate=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing tracing endpoint reached | ||
traceparent=found tracestate=found X-NewRelic-ID=missing X-NewRelic-Transaction=missing Customer-Header=found tracing endpoint reached | ||
*/ | ||
|
||
/*EXPECT_RESPONSE_HEADERS | ||
*/ | ||
|
||
/*EXPECT_METRICS | ||
[ | ||
"?? agent run id", | ||
"?? timeframe start", | ||
"?? timeframe stop", | ||
[ | ||
[{"name":"External/127.0.0.1/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/127.0.0.1/all", | ||
"scope":"OtherTransaction/php__FILE__"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/all"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"External/allOther"}, [3, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/library/Guzzle 4-5/detected"}, | ||
[2, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/library/Guzzle 6/detected"}, [1, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/library/Guzzle 7/detected"}, [1, 0, 0, 0, 0, 0]], | ||
[{"name":"Supportability/Unsupported/curl_setopt/CURLOPT_HEADERFUNCTION/closure"}, | ||
[3, 0, 0, 0, 0, 0]], | ||
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, | ||
[1, "??", "??", "??", "??", "??"]], | ||
[{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, | ||
[1, "??", "??", "??", "??", "??"]], | ||
[{"name":"Supportability/TraceContext/Create/Success"}, | ||
[3, "??", "??", "??", "??", "??"]] | ||
] | ||
] | ||
*/ | ||
|
||
?> | ||
<?php | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/config.php'); | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); | ||
require_guzzle(7); | ||
|
||
// create URL | ||
$url = "http://" . make_tracing_url(realpath(dirname(__FILE__)) . '/../../../include/tracing_endpoint.php'); | ||
|
||
//and now use guzzle 7 to make an http request | ||
use GuzzleHttp\Client; | ||
|
||
$client = new Client(); | ||
$response = $client->get($url); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap']]); | ||
echo $response->getBody(); | ||
|
||
$response = $client->get($url, [ | ||
'headers' => [ | ||
'zip' => 'zap', | ||
CUSTOMER_HEADER => 'zap']]); | ||
echo $response->getBody(); |
Oops, something went wrong.