Skip to content

Commit 3869a62

Browse files
committed
split tests
1 parent 5ca4df6 commit 3869a62

File tree

2 files changed

+70
-9
lines changed

2 files changed

+70
-9
lines changed

tests/integration/memcached/test_add_servers.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/*DESCRIPTION
88
The agent should report instance metrics when multiple servers are
9-
added at once
9+
added at once via Memcached::addServers()
1010
*/
1111

1212
/*SKIPIF
@@ -17,12 +17,14 @@
1717
*/
1818

1919
/*EXPECT_METRICS_EXIST
20-
Datastore/instance/Memcached/host1/1
21-
Datastore/instance/Memcached/host2/2
22-
Datastore/instance/Memcached/host3/11211
23-
Datastore/instance/Memcached/host4/1
20+
Datastore/instance/Memcached/host1/1, 1
21+
Datastore/instance/Memcached/host2/2, 1
22+
Datastore/instance/Memcached/host3/11211, 1
23+
Datastore/instance/Memcached/host4/1, 1
2424
*/
2525

26+
/*EXPECT_ERROR_EVENTS null */
27+
2628
require_once(realpath (dirname ( __FILE__ )) . '/../../include/helpers.php');
2729
require_once(realpath (dirname ( __FILE__ )) . '/../../include/tap.php');
2830
require_once(realpath (dirname ( __FILE__ )) . '/memcache.inc');
@@ -34,8 +36,4 @@
3436
array("host3", 11211)));
3537
$memcached->addServers(array());
3638
$memcached->addServers(array(array("host4", 1, "test field")));
37-
$memcached->addServers(array(array(1)));
38-
$memcached->addServers(array(array("host1")));
39-
$memcached->addServers(array(array(1, "host1")));
40-
//$memcahed->addServers("string"); crashes PHP
4139
$memcached->quit();
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/*
3+
* Copyright 2020 New Relic Corporation. All rights reserved.
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/*DESCRIPTION
8+
The agent should gracefully handle when malformed server entries
9+
are added via Memcached::addServers()
10+
*/
11+
12+
/*SKIPIF
13+
<?php require('skipif.inc'); ?>
14+
*/
15+
16+
/*INI
17+
*/
18+
19+
/*EXPECT_REGEX
20+
^\s*(PHP )?Warning:\s*could not add entry\s*$
21+
^\s*(PHP )?Warning:\s*could not add entry\s*$
22+
*/
23+
24+
/*EXPECT_ERROR_EVENTS
25+
[
26+
"?? agent run id",
27+
{
28+
"reservoir_size": "??",
29+
"events_seen": 1
30+
},
31+
[
32+
[
33+
{
34+
"type": "TransactionError",
35+
"timestamp": "??",
36+
"error.class": "E_WARNING",
37+
"error.message": "Memcached::addServers(): could not add entry #2 to the server list",
38+
"transactionName": "OtherTransaction\/php__FILE__",
39+
"duration": "??",
40+
"nr.transactionGuid": "??",
41+
"guid": "??",
42+
"sampled": true,
43+
"priority": "??",
44+
"traceId": "??",
45+
"spanId": "??"
46+
},
47+
{},
48+
{}
49+
]
50+
]
51+
]
52+
*/
53+
54+
require_once(realpath (dirname ( __FILE__ )) . '/../../include/helpers.php');
55+
require_once(realpath (dirname ( __FILE__ )) . '/../../include/tap.php');
56+
require_once(realpath (dirname ( __FILE__ )) . '/memcache.inc');
57+
58+
$memcached = new Memcached();
59+
$memcached->addServers(array(array(1)));
60+
$memcached->addServers(array(array("host1")));
61+
$memcached->addServers(array(array(1, "host1")));
62+
//$memcahed->addServers("string"); crashes PHP
63+
$memcached->quit();

0 commit comments

Comments
 (0)