Skip to content

Commit 1518bfd

Browse files
committed
Merge pull request #714
2 parents 5b89139 + 6f1bb0f commit 1518bfd

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

tests/causal-consistency/causal-consistency-010.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Causal consistency: unacknowledged write does not update operationTime
33
--SKIPIF--
44
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5-
<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
5+
<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
66
--FILE--
77
<?php
88
require_once __DIR__ . "/../utils/basic.inc";
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Causal consistency: $clusterTime is not sent in commands to unsupported deployments
3+
--SKIPIF--
4+
<?php if (getenv("TRAVIS")) exit("skip This currently fails on Travis because it doesn't run 3.6 yet"); ?>
5+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
6+
<?php NEEDS('STANDALONE'); ?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . "/../utils/basic.inc";
10+
require_once __DIR__ . "/../utils/observer.php";
11+
12+
(new CommandObserver)->observe(
13+
function() {
14+
$manager = new MongoDB\Driver\Manager(STANDALONE);
15+
$session = $manager->startSession();
16+
17+
$query = new MongoDB\Driver\Query([]);
18+
$manager->executeQuery(NS, $query, ['session' => $session]);
19+
$manager->executeQuery(NS, $query, ['session' => $session]);
20+
},
21+
function(stdClass $command)
22+
{
23+
$hasClusterTime = isset($command->{'$clusterTime'});
24+
printf("Command includes \$clusterTime: %s\n", ($hasClusterTime ? 'yes' : 'no'));
25+
}
26+
);
27+
28+
?>
29+
===DONE===
30+
<?php exit(0); ?>
31+
--EXPECT--
32+
Command includes $clusterTime: no
33+
Command includes $clusterTime: no
34+
===DONE===
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--TEST--
2+
Causal consistency: $clusterTime is sent in commands to supported deployments
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
<?php NEEDS('REPLICASET'); ?>
6+
--FILE--
7+
<?php
8+
require_once __DIR__ . "/../utils/basic.inc";
9+
require_once __DIR__ . "/../utils/observer.php";
10+
11+
(new CommandObserver)->observe(
12+
function() {
13+
$manager = new MongoDB\Driver\Manager(REPLICASET);
14+
$session = $manager->startSession();
15+
16+
$query = new MongoDB\Driver\Query([]);
17+
$manager->executeQuery(NS, $query, ['session' => $session]);
18+
$manager->executeQuery(NS, $query, ['session' => $session]);
19+
},
20+
function(stdClass $command)
21+
{
22+
$hasClusterTime = isset($command->{'$clusterTime'});
23+
printf("Command includes \$clusterTime: %s\n", ($hasClusterTime ? 'yes' : 'no'));
24+
}
25+
);
26+
27+
?>
28+
===DONE===
29+
<?php exit(0); ?>
30+
--EXPECT--
31+
Command includes $clusterTime: yes
32+
Command includes $clusterTime: yes
33+
===DONE===

0 commit comments

Comments
 (0)