3
3
namespace tests \RavenDB \Test \Issues \RavenDB_15497Test ;
4
4
5
5
use Exception ;
6
- use RavenDB \Documents \Indexes \IndexStats ;
7
- use RavenDB \Documents \Operations \Indexes \DisableIndexOperation ;
8
- use RavenDB \Documents \Operations \Indexes \GetIndexStatisticsOperation ;
9
- use RavenDB \Exceptions \TimeoutException ;
6
+ use RavenDB \Documents \Operations \Indexes \StopIndexOperation ;
7
+ use RavenDB \Exceptions \RavenTimeoutException ;
10
8
use RavenDB \Type \Duration ;
11
9
use tests \RavenDB \Infrastructure \Entity \User ;
12
10
use tests \RavenDB \RemoteTestBase ;
@@ -20,18 +18,12 @@ public function testWaitForIndexesAfterSaveChangesCanExitWhenThrowOnTimeoutIsFal
20
18
try {
21
19
$ index = new Index ();
22
20
$ index ->execute ($ store );
23
- $ store ->maintenance ()->send (new DisableIndexOperation ($ index ->getIndexName ()));
24
-
25
- /** @var IndexStats $indexStats */
26
- $ indexStats = $ store ->maintenance ()->send (new GetIndexStatisticsOperation ($ index ->getIndexName ()));
27
-
28
- $ this ->assertTrue ($ indexStats ->getState ()->isDisabled ());
29
- $ this ->assertTrue ($ indexStats ->getStatus ()->isDisabled ());
30
21
31
22
$ session = $ store ->openSession ();
32
23
try {
33
24
$ user = new User ();
34
25
$ user ->setName ("user1 " );
26
+ $ user ->setCount (3 );
35
27
36
28
$ session ->store ($ user );
37
29
@@ -44,6 +36,10 @@ public function testWaitForIndexesAfterSaveChangesCanExitWhenThrowOnTimeoutIsFal
44
36
$ session ->close ();
45
37
}
46
38
39
+ $ this ->waitForIndexing ($ store );
40
+
41
+ $ store ->maintenance ()->send (new StopIndexOperation ($ index ->getIndexName ()));
42
+
47
43
$ session = $ store ->openSession ();
48
44
try {
49
45
$ user = new User ();
@@ -60,9 +56,9 @@ public function testWaitForIndexesAfterSaveChangesCanExitWhenThrowOnTimeoutIsFal
60
56
$ session ->saveChanges ();
61
57
throw new Exception ('It should throw exception before reaching this code ' );
62
58
} catch (Throwable $ exception ) {
63
- $ this ->assertInstanceOf (TimeoutException ::class, $ exception );
64
- $ this ->assertStringContainsString ("System.TimeoutException " , $ exception ->getMessage ());
65
- $ this ->assertStringContainsString ("could not verify that 1 indexes has caught up with the changes as of etag " , $ exception ->getMessage ());
59
+ $ this ->assertInstanceOf (RavenTimeoutException ::class, $ exception );
60
+ $ this ->assertStringContainsString ("RavenTimeoutException " , $ exception ->getMessage ());
61
+ $ this ->assertStringContainsString ("could not verify that " , $ exception ->getMessage ());
66
62
}
67
63
} finally {
68
64
$ session ->close ();
0 commit comments