Skip to content

Commit 79ffb94

Browse files
lavaroubduranleau-nr
authored andcommitted
tests(agent): enhance guzzle tests (#713)
* cleanup skipif.inc for guzzle5: skipif.inc for guzzle5 ensures tests run on correct version of PHP and skip test if PHP version does not fall into >=5.4,<7.4 interval. Additionally, it warns (and skips) if guzzle5 installation is not found. * add skipif.inc for guzzle6 skipif.inc for guzzle6 ensures tests run on correct version of PHP and skip test if PHP version does not fall into >=5.5,<8.0 interval. Additionally, it warns (and skips) if guzzle6 installation is not found. * add tests for version 7 of guzzle Version 6 of Guzzle supports PHPs up to but not including 8.0. In order to test agent's instrumentation of guzzle on PHPs 8.0+, version 7 of Guzzle needs to be used. There are no fundamental changes in version 7 of Guzzle therefore agent's instrumentation of version 6 of guzzle works for version 7 too. However, this results in guzzle7 being detected as guzzle6 and that's why metrics in integration tests expectation include `Supportability/library/Guzzle 6/detected` as well as `Supportability/library/Guzzle 4-5/detected`. * composer update guzzle 6 & 7 in guzzle.tar.bz2 - Upgrading guzzlehttp/guzzle (6.3.3 => 6.5.8) (with dependencies) - Upgrading guzzlehttp/guzzle (7.4.5 => 7.7.0) (with dependencies)
1 parent 74873d8 commit 79ffb94

26 files changed

+619
-117
lines changed

tests/include/guzzle.tar.bz2

282 KB
Binary file not shown.

tests/integration/external/guzzle5/skipif.inc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
if (version_compare(PHP_VERSION, '8.1', '>=')) {
8-
die("skip: PHP < 8.1 required\n");
7+
if (version_compare(PHP_VERSION, '5.5', '<')) {
8+
die("skip: PHP >= 5.5 required\n");
99
}
1010

11+
if (version_compare(PHP_VERSION, '7.4', '>=')) {
12+
die("skip: PHP < 7.4 required\n");
13+
}
14+
15+
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
16+
1117
if (!unpack_guzzle(5)) {
12-
die("skip: guzzle 5 installation required\n");
18+
die("warn: guzzle 5 installation required\n");
1319
}

tests/integration/external/guzzle5/test_cat.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
1614
17-
if (version_compare(phpversion(), '5.4.0', '<')) {
18-
die("skip: PHP >= 5.4.0 required\n");
19-
}
20-
2115
if (!isset($_ENV["ACCOUNT_supportability"]) || !isset($_ENV["APP_supportability"])) {
2216
die("skip: env vars required");
2317
}

tests/integration/external/guzzle5/test_dt.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
16-
17-
if (version_compare(phpversion(), '5.5.0', '<')) {
18-
die("skip: PHP >= 5.5.0 required\n");
19-
}
2014
*/
2115

2216
/*INI

tests/integration/external/guzzle5/test_dt_newrelic_header_disabled.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
16-
17-
if (version_compare(phpversion(), '5.5.0', '<')) {
18-
die("skip: PHP >= 5.5.0 required\n");
19-
}
2014
*/
2115

2216
/*INI

tests/integration/external/guzzle5/test_dt_synthetics.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
1614
17-
if (version_compare(phpversion(), '5.4.0', '<')) {
18-
die("skip: PHP >= 5.4.0 required\n");
19-
}
20-
2115
if (!isset($_ENV["SYNTHETICS_HEADER_supportability"])) {
2216
die("skip: env vars required");
2317
}

tests/integration/external/guzzle5/test_dt_synthetics_logging_off.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
1614
17-
if (version_compare(phpversion(), '5.4.0', '<')) {
18-
die("skip: PHP >= 5.4.0 required\n");
19-
}
20-
2115
if (!isset($_ENV["SYNTHETICS_HEADER_supportability"])) {
2216
die("skip: env vars required");
2317
}

tests/integration/external/guzzle5/test_no_cat_no_dt.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@
55
*/
66

77
/*DESCRIPTION
8-
Test that Cross Application Tracing (CAT) works with guzzle 5.
8+
Test that neither CAT nor DT headers are added when CAT and DT are disabled.
99
*/
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
16-
17-
if (version_compare(phpversion(), '5.4.0', '<')) {
18-
die("skip: PHP >= 5.4.0 required\n");
19-
}
2014
*/
2115

2216
/*INI

tests/integration/external/guzzle5/test_spans_external.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
1614
1715
if (version_compare(PHP_VERSION, "7.0", "<")) {

tests/integration/external/guzzle5/test_spans_external.php5.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010

1111
/*SKIPIF
1212
<?php
13-
require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php');
14-
1513
require('skipif.inc');
16-
17-
if (version_compare(phpversion(), '5.4.0', '<')) {
18-
die("skip: PHP >= 5.4.0 required\n");
19-
}
2014
*/
2115

2216
/*INI

0 commit comments

Comments
 (0)