-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from hexfusion/maint
Add Maintenance class.
- Loading branch information
Showing
5 changed files
with
98 additions
and
1 deletion.
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
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,46 @@ | ||
use utf8; | ||
package Net::Etcd::Maintenance; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
=encoding utf8 | ||
=cut | ||
use Moo; | ||
|
||
with 'Net::Etcd::Role::Actions'; | ||
use namespace::clean; | ||
|
||
=head1 NAME | ||
Net::Etcd::Maintenance | ||
=cut | ||
|
||
our $VERSION = '0.009'; | ||
|
||
=head1 DESCRIPTION | ||
Provides support for maintenance related actions. | ||
=cut | ||
|
||
=head1 PUBLIC METHODS | ||
=head2 snapshot | ||
Snapshot sends a snapshot of the entire backend from a member over a stream to a client. | ||
=cut | ||
|
||
sub snapshot { | ||
my ( $self, $options ) = @_; | ||
my $cb = pop if ref $_[-1] eq 'CODE'; | ||
$self->{endpoint} = '/maintenance/snapshot'; | ||
$self->{json_args} = '{}'; | ||
$self->request; | ||
return $self; | ||
} | ||
|
||
1; |
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,33 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
use Net::Etcd; | ||
use Test::More; | ||
use Test::Exception; | ||
use Data::Dumper; | ||
my ($host, $port); | ||
|
||
if ( $ENV{ETCD_TEST_HOST} and $ENV{ETCD_TEST_PORT}) { | ||
$host = $ENV{ETCD_TEST_HOST}; | ||
$port = $ENV{ETCD_TEST_PORT}; | ||
plan tests => 2; | ||
} | ||
else { | ||
plan skip_all => "Please set environment variable ETCD_TEST_HOST and ETCD_TEST_PORT."; | ||
} | ||
|
||
my $maint; | ||
my $etcd = Net::Etcd->new( { host => $host, port => $port } ); | ||
|
||
lives_ok( | ||
sub { | ||
$maint = $etcd->maintenance()->snapshot; | ||
}, | ||
"snapshot create" | ||
); | ||
|
||
#print STDERR Dumper($maint); | ||
cmp_ok( $maint->{response}{content}, 'ne', "", "snapshot create" ); | ||
|
||
1; |