Skip to content

Commit 5597d7f

Browse files
committed
concise unit tests
1 parent 63beced commit 5597d7f

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

agent/tests/test_memcached.c

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,57 +38,39 @@ static void test_create_datastore_instance(void) {
3838

3939
assert_datastore_instance_equals_destroy(
4040
"empty host",
41-
&((nr_datastore_instance_t){
42-
.host = "unknown",
43-
.database_name = "unknown",
44-
.port_path_or_id = "6379",
45-
}),
46-
nr_php_memcached_create_datastore_instance("", 6379));
47-
48-
assert_datastore_instance_equals_destroy(
49-
"localhost socket",
50-
&((nr_datastore_instance_t){
51-
.host = system_host_name,
52-
.database_name = "unknown",
53-
.port_path_or_id = "localhost",
54-
}),
55-
nr_php_memcached_create_datastore_instance("localhost", 0));
56-
57-
assert_datastore_instance_equals_destroy(
58-
"localhost and port",
5941
&((nr_datastore_instance_t){
6042
.host = system_host_name,
6143
.database_name = "unknown",
62-
.port_path_or_id = "6379",
44+
.port_path_or_id = "unknown",
6345
}),
64-
nr_php_memcached_create_datastore_instance("localhost", 6379));
46+
nr_php_memcached_create_datastore_instance(NULL, 0));
6547

6648
assert_datastore_instance_equals_destroy(
6749
"host.name socket",
6850
&((nr_datastore_instance_t){
69-
.host = system_host_name,
51+
.host = "host.name",
7052
.database_name = "unknown",
71-
.port_path_or_id = "host.name",
53+
.port_path_or_id = "11211",
7254
}),
73-
nr_php_memcached_create_datastore_instance("host.name", 0));
55+
nr_php_memcached_create_datastore_instance("host.name", 11211));
7456

7557
assert_datastore_instance_equals_destroy(
7658
"host and port",
7759
&((nr_datastore_instance_t){
78-
.host = "host.name",
60+
.host = "unknown",
7961
.database_name = "unknown",
8062
.port_path_or_id = "6379",
8163
}),
82-
nr_php_memcached_create_datastore_instance("host.name", 6379));
64+
nr_php_memcached_create_datastore_instance("", 6379));
8365

8466
assert_datastore_instance_equals_destroy(
8567
"NULL socket",
8668
&((nr_datastore_instance_t){
87-
.host = system_host_name,
69+
.host = "unknown",
8870
.database_name = "unknown",
89-
.port_path_or_id = "unknown",
71+
.port_path_or_id = "11211",
9072
}),
91-
nr_php_memcached_create_datastore_instance(NULL, 0));
73+
nr_php_memcached_create_datastore_instance(NULL, 11211));
9274
}
9375

9476
void test_main(void* p NRUNUSED) {

0 commit comments

Comments
 (0)