forked from memcached/memcached
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'shutdown graceful' command for raising SIGUSR1
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use FindBin qw($Bin); | ||
use lib "$Bin/lib"; | ||
use MemcachedTest; | ||
|
||
# Disabled shutdown (default) | ||
{ | ||
my $server = new_memcached(); | ||
my $sock = $server->sock; | ||
print $sock "shutdown\r\n"; | ||
is(scalar <$sock>, "ERROR: shutdown not enabled\r\n", | ||
"error when shutdown is not enabled"); | ||
} | ||
|
||
# Shutdown command error | ||
{ | ||
my$server = new_memcached("-A"); | ||
my $sock = $server->sock; | ||
print $sock "shutdown foo\r\n"; | ||
like(scalar <$sock>, qr/CLIENT_ERROR/, "rejected invalid shutdown mode"); | ||
} | ||
|
||
# Normal shutdown | ||
{ | ||
my $server = new_memcached("-A"); | ||
my $sock = $server->sock; | ||
print $sock "version\r\n"; | ||
like(scalar <$sock>, qr/VERSION/, "server is initially alive"); | ||
print $sock "shutdown\r\n"; | ||
print $sock "version\r\n"; | ||
is(scalar <$sock>, undef, "server has been normally shut down"); | ||
} | ||
|
||
# Graceful shutdown | ||
{ | ||
my $server = new_memcached("-A"); | ||
my $sock = $server->sock; | ||
print $sock "version\r\n"; | ||
like(scalar <$sock>, qr/VERSION/, "server is initially alive"); | ||
print $sock "shutdown graceful\r\n"; | ||
print $sock "version\r\n"; | ||
is(scalar <$sock>, undef, "server has been gracefully shut down"); | ||
} | ||
|
||
done_testing(); |