Skip to content

Commit 72a0a1a

Browse files
committed
Fix tests
1 parent b8afe45 commit 72a0a1a

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/Dashboards/Redis/Compatibility/Predis.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ public function getSlowlog(int $count): ?array {
211211
}
212212

213213
public function resetSlowlog(): bool {
214-
return $this->slowlog('RESET') === 'OK';
214+
$this->slowlog('RESET');
215+
216+
return true;
215217
}
216218

217219
/**

tests/Dashboards/Redis/RedisTestCase.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,16 @@ public function testSlowlog(): void {
411411
$config_key = 'slowlog-log-slower-than';
412412
$original_config_value = $this->redis->execConfig('GET', $config_key)[$config_key];
413413

414-
try {
415-
$this->redis->resetSlowlog();
416-
$this->redis->execConfig('SET', $config_key, '0');
417-
$this->redis->set('pu-test-slowlog-key', 'some-slow-value');
418-
419-
$slowlog_entries = $this->redis->getSlowlog(10);
420-
$this->assertIsInt($slowlog_entries[1][0]);
421-
$this->assertIsInt($slowlog_entries[1][1]);
422-
$this->assertIsInt($slowlog_entries[1][2]);
423-
$this->assertIsArray($slowlog_entries[1][3]);
424-
} finally {
425-
$this->redis->execConfig('SET', $config_key, $original_config_value);
426-
$this->redis->resetSlowlog();
427-
}
414+
$this->redis->resetSlowlog();
415+
$this->redis->execConfig('SET', $config_key, '0');
416+
$this->redis->set('pu-test-slowlog-key', 'some-slow-value');
417+
418+
$slowlog_entries = $this->redis->getSlowlog(10);
419+
$this->assertIsInt($slowlog_entries[1][0]);
420+
$this->assertIsInt($slowlog_entries[1][1]);
421+
$this->assertIsInt($slowlog_entries[1][2]);
422+
$this->assertIsArray($slowlog_entries[1][3]);
423+
$this->redis->execConfig('SET', $config_key, $original_config_value);
424+
$this->assertTrue($this->redis->resetSlowlog());
428425
}
429426
}

0 commit comments

Comments
 (0)