Skip to content

Commit 0f6de97

Browse files
committed
Disable client setname and select operations (#42)
Temporarily disable these features due to a bug in glide core. Signed-off-by: James Duong <[email protected]>
1 parent e3ebbdc commit 0f6de97

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

tests/ValkeyGlideClusterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public function testClient()
382382
{
383383
$key = 'key-' . rand(1, 100);
384384

385-
$this->assertTrue($this->valkey_glide->client($key, 'setname', 'cluster_tests'));
385+
// $this->assertTrue($this->valkey_glide->client($key, 'setname', 'cluster_tests'));
386386

387387
$clients = $this->valkey_glide->client($key, 'list');
388388
$this->assertIsArray($clients);
@@ -397,10 +397,10 @@ public function testClient()
397397
}
398398

399399
/* We should be in there */
400-
$this->assertIsString($addr);
400+
// $this->assertIsString($addr);
401401

402402
/* Kill our own client! */
403-
$this->assertTrue($this->valkey_glide->client($key, 'kill', $addr));
403+
// $this->assertTrue($this->valkey_glide->client($key, 'kill', $addr));
404404
}
405405

406406
public function testTime()

tests/ValkeyGlideTest.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,22 +1590,23 @@ public function testMove()
15901590
$value2 = 'test_value2';
15911591

15921592
// Ensure we're in database 0
1593-
$this->valkey_glide->select(0);
1593+
// $this->valkey_glide->select(0);
15941594

15951595
// Clean up any existing keys
15961596
$this->valkey_glide->del($key1, $key2);
1597-
$this->valkey_glide->select(1);
1597+
// $this->valkey_glide->select(1);
15981598
$this->valkey_glide->del($key1, $key2);
1599-
$this->valkey_glide->select(0);
1599+
// $this->valkey_glide->select(0);
16001600

16011601
// Test successful move
16021602
$this->valkey_glide->set($key1, $value1);
16031603
$this->assertTrue($this->valkey_glide->move($key1, 1));
16041604

16051605
// Verify key moved
16061606
$this->assertEquals(0, $this->valkey_glide->exists($key1)); // Gone from db 0
1607-
$this->valkey_glide->select(1);
1608-
$this->assertKeyEquals($value1, $key1); // Present in db 1
1607+
// Verification disabled until select() command is supported.
1608+
// $this->valkey_glide->select(1);
1609+
// $this->assertKeyEquals($value1, $key1); // Present in db 1
16091610
}
16101611

16111612
public function testBlmove()
@@ -2551,12 +2552,12 @@ public function testInfoCommandStats()
25512552
}
25522553
}
25532554

2554-
public function testSelect()
2555+
/* public function testSelect()
25552556
{
25562557
$this->assertFalse(@$this->valkey_glide->select(-1));
25572558
$this->assertTrue($this->valkey_glide->select(0));
25582559
}
2559-
2560+
*/
25602561

25612562

25622563
public function testMset()
@@ -5689,7 +5690,7 @@ public function testEvalSHA()
56895690
public function testClient()
56905691
{
56915692
/* CLIENT SETNAME */
5692-
$this->assertTrue($this->valkey_glide->client('setname', 'phpredis_unit_tests'));
5693+
// $this->assertTrue($this->valkey_glide->client('setname', 'phpredis_unit_tests'));
56935694

56945695
/* CLIENT LIST */
56955696
$clients = $this->valkey_glide->client('list');
@@ -5704,10 +5705,10 @@ public function testClient()
57045705
}
57055706

57065707
// We should have found our connection
5707-
$this->assertIsString($address);
5708+
// $this->assertIsString($address);
57085709

57095710
/* CLIENT GETNAME */
5710-
$this->assertEquals('phpredis_unit_tests', $this->valkey_glide->client('getname'));
5711+
// $this->assertEquals('phpredis_unit_tests', $this->valkey_glide->client('getname'));
57115712

57125713
if (version_compare($this->version, '5.0.0') >= 0) {
57135714
$this->assertGT(0, $this->valkey_glide->client('id'));
@@ -5724,7 +5725,7 @@ public function testClient()
57245725
}
57255726

57265727
/* CLIENT KILL -- phpredis will reconnect, so we can do this */
5727-
$this->assertTrue($this->valkey_glide->client('kill', $address));
5728+
// $this->assertTrue($this->valkey_glide->client('kill', $address));
57285729
}
57295730

57305731

@@ -5796,7 +5797,7 @@ public function testConfig()
57965797
$this->assertFalse(@$this->valkey_glide->config('set', [0, 1, 2]));
57975798
}
57985799

5799-
public function testReconnectSelect()
5800+
/* public function testReconnectSelect()
58005801
{
58015802
$key = 'reconnect-select';
58025803
$value = 'Has been set!';
@@ -5827,7 +5828,7 @@ public function testReconnectSelect()
58275828
// Revert the setting.
58285829
$this->valkey_glide->config('SET', 'timeout', $original_cfg['timeout']);
58295830
}
5830-
5831+
*/
58315832
public function testTime()
58325833
{
58335834
if (version_compare($this->version, '2.5.0') < 0) {

valkey_glide.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,7 @@ public function scard(string $key): ValkeyGlide|int|false;
23332333
*
23342334
* @example $valkey_glide->select(1);
23352335
*/
2336-
public function select(int $db): ValkeyGlide|bool;
2336+
// public function select(int $db): ValkeyGlide|bool;
23372337

23382338
/**
23392339
* Create or set a ValkeyGlide STRING key to a value.

valkey_glide_commands_3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,9 @@ int execute_client_command_internal(
14581458
command_type = ClientGetName;
14591459
else if (strcasecmp(subcmd, "ID") == 0)
14601460
command_type = ClientId;
1461-
else if (strcasecmp(subcmd, "SETNAME") == 0) {
1462-
command_type = ClientSetName;
1463-
} else if (strcasecmp(subcmd, "PAUSE") == 0)
1461+
// else if (strcasecmp(subcmd, "SETNAME") == 0)
1462+
// command_type = ClientSetName;
1463+
else if (strcasecmp(subcmd, "PAUSE") == 0)
14641464
command_type = ClientPause;
14651465
else if (strcasecmp(subcmd, "UNPAUSE") == 0)
14661466
command_type = ClientUnpause;

0 commit comments

Comments
 (0)