-
Notifications
You must be signed in to change notification settings - Fork 0
/
RetryTest.php
607 lines (544 loc) · 25.5 KB
/
RetryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<?php
declare(strict_types=1);
namespace Keboola\DbExtractor\Tests;
use Keboola\Csv\CsvFile;
use Keboola\DbExtractor\Application;
use Keboola\DbExtractor\Exception\UserException;
use Keboola\DbExtractor\Extractor\Common;
use Keboola\DbExtractor\Logger;
use Keboola\DbExtractor\Test\ExtractorTest;
use Keboola\Temp\Temp;
use Monolog\Handler\TestHandler;
use PDO;
use Symfony\Component\Debug\ErrorHandler;
class RetryTest extends ExtractorTest
{
private const ROW_COUNT = 1000000;
private const SERVER_KILLER_EXECUTABLE = 'php ' . __DIR__ . '/killerRabbit.php';
/**
* @var array
*/
private $dbParams;
/**
* @var PDO
*/
private $taintedPdo;
/**
* @var int
*/
private $fetchCount = 0;
/**
* @var ?string
*/
private $killerEnabled = null;
/**
* @var int
*/
private $pid;
/**
* @var \PDO
*/
private $serviceConnection;
public function setUp(): void
{
// intentionally don't call parent, we use a different PDO connection here
// must use waitForConnection, because the tests might leave the connection or server broken
$this->waitForConnection();
/* backup connection for killing the working connection to avoid error
`SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active`. */
$this->serviceConnection = $this->getConnection();
// unlink the output file if any
@unlink($this->dataDir . '/out/tables/in.c-main.sales.csv');
}
private function waitForConnection(): void
{
$retries = 0;
while (true) {
try {
$this->taintedPdo = null;
$conn = $this->getConnection();
$conn->query('SELECT NOW();')->execute();
$this->taintedPdo = $conn;
break;
} catch (\Throwable $e) {
fwrite(STDERR, 'Waiting for connection ' . $e->getMessage() . PHP_EOL);
sleep(5);
$retries++;
if ($retries > 10) {
throw new \Exception('Cannot establish connection to RDS.');
}
}
}
// save the PID of the current connection
$stmt = $this->taintedPdo->query('SELECT CONNECTION_ID() AS pid;');
$stmt->execute();
$this->pid = $stmt->fetch()['pid'];
}
private function waitForDeadConnection(): void
{
// wait for the connection to die
$cnt = 0;
while (true) {
try {
$this->taintedPdo->query('SELECT NOW();')->execute();
$cnt++;
if ($cnt > 50) {
self::fail('Failed to kill the server');
}
sleep(1);
} catch (\Throwable $e) {
break;
}
}
}
private function getConnection(): PDO
{
$this->dbParams = [
'user' => getenv('TEST_RDS_USERNAME'),
'#password' => getenv('TEST_RDS_PASSWORD'),
'host' => getenv('TEST_RDS_HOST'),
'database' => getenv('TEST_RDS_DATABASE'),
'port' => getenv('TEST_RDS_PORT'),
];
$dsn = sprintf(
"mysql:host=%s;port=%s;dbname=%s;charset=utf8",
$this->dbParams['host'],
$this->dbParams['port'],
$this->dbParams['database']
);
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_LOCAL_INFILE => true,
];
$pdo = new TaintedPDO($dsn, $this->dbParams['user'], $this->dbParams['#password'], $options);
// set a callback to the PDO class
$pdo->setOnEvent([$this, 'killConnection']);
$pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
// replace PDOStatement with our class, pass the connection and callback in constructor
$pdo->setAttribute(
PDO::ATTR_STATEMENT_CLASS,
/* value of ATTR_STATEMENT_CLASS is [className, ctorArgs], ctorArgs is array of arguments,
there is a single argument `[$this, 'killConnection']` which is a callable */
[TaintedPDOStatement::class, [[$this, 'killConnection']]]
);
return $pdo;
}
public function killConnection(string $event): void
{
// method must be public, because it's called from the TaintedPDO class
/*
fwrite(
STDERR,
sprintf(
'[%s] Event: %s, Killer: %s',
date('Y-m-d H:i:s'),
$event,
var_export($this->killerEnabled, true)
) . PHP_EOL
);
*/
if ($event === 'fetch') {
$this->fetchCount++;
}
if ($this->killerEnabled && ($this->killerEnabled === $event)) {
// kill only on every 1000th fetch event, otherwise this floods the server with errors (PID doesn't exist)
if (($event !== 'fetch') || (($event === 'fetch') && ($this->fetchCount % 1000 === 0))) {
//fwrite(STDERR, sprintf('[%s] Killing', date('Y-m-d H:i:s')) . PHP_EOL);
$this->doKillConnection();
}
}
}
private function doKillConnection(): void
{
try {
$this->serviceConnection->exec('KILL ' . $this->pid);
} catch (\Throwable $e) {
fwrite(STDERR, sprintf('[%s] Kill failed: %s', date('Y-m-d H:i:s'), $e->getMessage()) . PHP_EOL);
}
}
private function getRetryConfig(): array
{
$config = $this->getConfig('common', 'json');
$config['parameters']['db'] = $this->dbParams;
$config['parameters']['db']['password'] = $config['parameters']['db']['#password'];
$config['parameters']['tables'] = [[
'id' => 1,
'name' => 'sales',
'query' => 'SELECT * FROM sales',
'outputTable' => 'in.c-main.sales',
'incremental' => false,
'primaryKey' => null,
'enabled' => true,
'retries' => 10,
]];
return $config;
}
private function setupLargeTable(): void
{
$tableName = 'sales';
$temp = new Temp();
$temp->initRunFolder();
$sourceFileName = $temp->getTmpFolder() . '/large.csv';
$res = $this->serviceConnection->query(sprintf(
"SELECT *
FROM information_schema.tables
WHERE table_schema = '%s'
AND table_name = '%s'
LIMIT 1;",
getenv('TEST_RDS_DATABASE'),
$tableName
));
$tableExists = count($res->fetchAll()) > 0;
// Set up the data table
if (!$tableExists) {
$csv = new CsvFile($sourceFileName);
$header = ["usergender", "usercity", "usersentiment", "zipcode", "sku", "createdat", "category"];
$csv->writeRow($header);
for ($i = 0; $i < self::ROW_COUNT - 1; $i++) { // -1 for the header
$csv->writeRow(
[uniqid('g'), "The Lakes", "1", "89124", "ZD111402", "2013-09-23 22:38:30", uniqid('c')]
);
}
$createTableSql = sprintf(
"CREATE TABLE %s.%s (%s) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;",
getenv('TEST_RDS_DATABASE'),
$tableName,
implode(
', ',
array_map(function ($column) {
return $column . ' text NULL';
}, $header)
)
);
$this->serviceConnection->exec($createTableSql);
$fileName = (string) $csv;
$query = sprintf(
"LOAD DATA LOCAL INFILE '%s'
INTO TABLE `%s`.`%s`
CHARACTER SET utf8
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '\"'
ESCAPED BY ''
IGNORE 1 LINES",
$fileName,
getenv('TEST_RDS_DATABASE'),
$tableName
);
$this->serviceConnection->exec($query);
}
}
private function getLineCount(string $fileName): int
{
$lineCount = 0;
$handle = fopen($fileName, "r");
while (fgets($handle) !== false) {
$lineCount++;
}
fclose($handle);
return $lineCount;
}
public function testServerKiller(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests that the script to restart
the MySQL server works correctly. */
// unlike in the actual tests, here, the killer can be executed synchronously.
exec(self::SERVER_KILLER_EXECUTABLE . ' 0', $output, $ret);
$output = implode(PHP_EOL, $output);
// wait for the reboot to start (otherwise waitForConnection() would pass with the old connection
$this->waitForDeadConnection();
try {
$this->taintedPdo->query('SELECT NOW();')->execute();
self::fail('Connection must be dead now.');
} catch (\Throwable $e) {
}
$this->waitForConnection();
self::assertContains('Rabbit of Caerbannog', $output);
self::assertEquals(0, $ret, $output);
self::assertNotEmpty($this->taintedPdo);
}
public function testNetworkKillerQuery(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests whether network interruption
cause the exceptions which are expected in actual retry tests. */
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$this->killerEnabled = 'query';
self::expectException(\ErrorException::class);
self::expectExceptionMessage('Warning: PDO::query(): MySQL server has gone away');
$this->taintedPdo->query('SELECT NOW();');
}
public function testNetworkKillerPrepare(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests whether network interruption
cause the exceptions which are expected in actual retry tests. */
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$this->killerEnabled = 'prepare';
self::expectException(\ErrorException::class);
/* It's ok that `PDOStatement::execute` is reported, because on prepare
is done on client (see testNetworkKillerTruePrepare). */
self::expectExceptionMessage('Warning: PDOStatement::execute(): MySQL server has gone away');
$stmt = $this->taintedPdo->prepare('SELECT NOW();');
$stmt->execute();
}
public function testNetworkKillerTruePrepare(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests whether network interruption
cause the exceptions which are expected in actual retry tests. */
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$this->taintedPdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$this->killerEnabled = 'prepare';
self::expectException(\ErrorException::class);
/* With emulated prepare turned off (ATTR_EMULATE_PREPARES above), the error occurs truly in
`PDO::prepare()`, see testNetworkKillerPrepare. */
self::expectExceptionMessage('Warning: PDO::prepare(): MySQL server has gone away');
$this->taintedPdo->prepare('SELECT NOW();');
}
public function testNetworkKillerExecute(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests whether network interruption
cause the exceptions which are expected in actual retry tests. */
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$stmt = $this->taintedPdo->query('SELECT NOW();');
$this->killerEnabled = 'execute';
self::expectException(\ErrorException::class);
self::expectExceptionMessage('Warning: PDOStatement::execute(): MySQL server has gone away');
$stmt->execute();
}
public function testNetworkKillerFetch(): void
{
/* This is not an actual test of DbExtractorCommon, rather it tests whether network interruption
cause the exceptions which are expected in actual retry tests. */
$this->setupLargeTable();
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$stmt = $this->taintedPdo->query('SELECT * FROM sales LIMIT 100000');
$stmt->execute();
self::expectException(\ErrorException::class);
self::expectExceptionMessage('Warning: Empty row packet body');
$this->killerEnabled = 'fetch';
/** @noinspection PhpStatementHasEmptyBodyInspection */
while ($row = $stmt->fetch()) {
}
}
public function testRunMainRetryServerError(): void
{
/* Test that the entire table is downloaded and the result is full table (i.e. the download
was retried, and the partial result was discarded. */
$this->setupLargeTable();
$config = $this->getRetryConfig();
$app = $this->getApplication('ex-db-common', $config);
// execute asynchronously the script to reboot the server
exec(self::SERVER_KILLER_EXECUTABLE . ' 2 > /dev/null &');
$result = $app->run();
$outputCsvFile = $this->dataDir . '/out/tables/' . $result['imported'][0]['outputTable'] . '.csv';
self::assertEquals('success', $result['status']);
self::assertFileExists($outputCsvFile);
self::assertFileExists($outputCsvFile . '.manifest');
self::assertEquals(self::ROW_COUNT, $this->getLineCount($outputCsvFile));
}
public function testConnectServerError(): void
{
self::markTestSkipped('This test is a bit unstable');
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$this->setupLargeTable();
$config = $this->getRetryConfig();
// execute asynchronously the script to reboot the server
exec(self::SERVER_KILLER_EXECUTABLE . ' 0');
$this->waitForDeadConnection();
$app = new Application($config, $logger, []);
try {
$app->run();
self::fail('Must raise exception.');
} catch (UserException $e) {
self::assertFalse($handler->hasInfoThatContains('Retrying...'));
self::assertContains('Error connecting to DB: SQLSTATE[HY000] [2002] Connection refused', $e->getMessage());
}
}
public function testRetryNetworkErrorPrepare(): void
{
$rowCount = 100;
$this->setupLargeTable();
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$config = $this->getRetryConfig();
$config['parameters']['tables'][0]['query'] = 'SELECT * FROM sales LIMIT ' . $rowCount;
$extractor = new Common($config['parameters'], [], $logger);
// plant the tainted PDO into the extractor
$reflectionProperty = new \ReflectionProperty($extractor, 'db');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($extractor, $this->taintedPdo);
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
// This will cause interrupt before PDO::prepare(), see testNetworkKillerPrepare
$this->killerEnabled = 'prepare';
$result = $extractor->export($config['parameters']['tables'][0]);
$outputCsvFile = $this->dataDir . '/out/tables/' . $result['outputTable'] . '.csv';
self::assertFileExists($outputCsvFile);
self::assertFileExists($outputCsvFile . '.manifest');
self::assertEquals($rowCount + 1, $this->getLineCount($outputCsvFile));
self::assertTrue($handler->hasInfoThatContains('Retrying...'));
/* it's ok that `PDOStatement::execute()` is reported here,
because prepared statements are PDO emulated (see testNetworkKillerPrepare). */
self::assertTrue($handler->hasInfoThatContains(
'Warning: PDOStatement::execute(): MySQL server has gone away. Retrying'
));
}
public function testRetryNetworkErrorExecute(): void
{
$rowCount = 100;
$this->setupLargeTable();
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$config = $this->getRetryConfig();
$config['parameters']['tables'][0]['query'] = 'SELECT * FROM sales LIMIT ' . $rowCount;
$extractor = new Common($config['parameters'], [], $logger);
// plant the tainted PDO into the extractor
$reflectionProperty = new \ReflectionProperty($extractor, 'db');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($extractor, $this->taintedPdo);
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
// This will cause interrupt before PDO::prepare(), see testNetworkKillerPrepare
$this->killerEnabled = 'prepare';
$result = $extractor->export($config['parameters']['tables'][0]);
$outputCsvFile = $this->dataDir . '/out/tables/' . $result['outputTable'] . '.csv';
self::assertFileExists($outputCsvFile);
self::assertFileExists($outputCsvFile . '.manifest');
self::assertEquals(100 + 1, $this->getLineCount($outputCsvFile));
self::assertTrue($handler->hasInfoThatContains('Retrying...'));
self::assertTrue($handler->hasInfoThatContains(
'Warning: PDOStatement::execute(): MySQL server has gone away. Retrying'
));
}
public function testRetryNetworkErrorFetch(): void
{
/* This has to be large enough so that it doesn't fit into
prefetch cache (which exists, but seems to be undocumented). */
$rowCount = 1000000;
$this->setupLargeTable();
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$config = $this->getRetryConfig();
$config['parameters']['tables'][0]['query'] = 'SELECT * FROM sales LIMIT ' . $rowCount;
$extractor = new Common($config['parameters'], [], $logger);
// plant the tainted PDO into the extractor
$reflectionProperty = new \ReflectionProperty($extractor, 'db');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($extractor, $this->taintedPdo);
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
// This will cause interrupt before PDO::prepare(), see testNetworkKillerPrepare
$this->killerEnabled = 'fetch';
$result = $extractor->export($config['parameters']['tables'][0]);
$outputCsvFile = $this->dataDir . '/out/tables/' . $result['outputTable'] . '.csv';
self::assertFileExists($outputCsvFile);
self::assertFileExists($outputCsvFile . '.manifest');
self::assertEquals($rowCount, $this->getLineCount($outputCsvFile));
self::assertTrue($handler->hasInfoThatContains('Retrying...'));
self::assertTrue($handler->hasInfoThatContains('Warning: Empty row packet body. Retrying... [1x]'));
}
public function testRetryNetworkErrorFetchFailure(): void
{
$rowCount = 100;
$this->setupLargeTable();
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$config = $this->getRetryConfig();
$config['parameters']['tables'][0]['query'] = 'SELECT * FROM sales LIMIT ' . $rowCount;
// plant the tainted PDO into the createConnection method of the extractor
$extractor = self::getMockBuilder(Common::class)
->setMethods(['createConnection'])
->setConstructorArgs([$config['parameters'], [], $logger])
->disableAutoReturnValueGeneration()
->getMock();
$extractor->method('createConnection')->willReturn($this->taintedPdo);
// plant the tainted PDO into the extractor
$reflectionProperty = new \ReflectionProperty($extractor, 'db');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($extractor, $this->taintedPdo);
/* Both of the above are needed because the DB connection is initialized in the Common::__construct()
using the `createConnection` method. That means that during instantiation of the mock, the createConnection
method is called and returns garbage (because it's a mock with yet undefined value). The original
constructor cannot be disabled, because it does other things (and even if it weren't, it still has to
set the connection internally. That's why we need to use reflection to plant our PDO into the extractor.
(so that overwrites the mock garbage which gets there in the ctor).
However, when the connection is broken, and retried, the `createConnection` method is called again, by
making it return the tainted PDO too, we'll ensure that the extractor will be unable to recreate the
connection, thus testing that it does fail after certain number of retries.
*/
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
$this->killerEnabled = 'prepare';
try {
/** @var Common $extractor */
$extractor->export($config['parameters']['tables'][0]);
self::fail('Must raise exception.');
} catch (UserException $e) {
self::assertTrue($handler->hasInfoThatContains('Retrying...'));
self::assertTrue($handler->hasInfoThatContains(
'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away. Retrying... [9x]'
));
self::assertContains(
'query failed: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away Tried 10 times.',
$e->getMessage()
);
}
}
public function testRetryException(): void
{
$handler = new TestHandler();
$logger = new Logger('test');
$logger->pushHandler($handler);
$config = $this->getRetryConfig();
$config['parameters']['tables'][0]['query'] = 'SELECT * FROM non_existent_table';
$extractor = new Common($config['parameters'], [], $logger);
// plant the tainted PDO into the extractor
$reflectionProperty = new \ReflectionProperty($extractor, 'db');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($extractor, $this->taintedPdo);
/* Register symfony error handler (used in production) and replace phpunit error handler. This
is very important to receive correct type of exception (\ErrorException), otherwise Phpunit
will convert the warnings to PHPUnit\Framework\Error\Warning */
ErrorHandler::register(null, true);
try {
$extractor->export($config['parameters']['tables'][0]);
self::fail('Must raise exception.');
} catch (UserException $e) {
self::assertContains(
'1146 Table \'odin4test.non_existent_table\' doesn\'t exist Tried 10 times',
$e->getMessage()
);
self::assertTrue($handler->hasInfoThatContains('Retrying...'));
self::assertTrue($handler->hasInfoThatContains(
'1146 Table \'odin4test.non_existent_table\' doesn\'t exist. Retrying... [9x]'
));
}
}
}