line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Docker::Image::Boot; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
93563
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
154
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
129
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
2609
|
use Test::Docker::Image::Utility qw(docker); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
1138
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
3
|
|
|
3
|
0
|
21
|
my $class = shift; |
10
|
3
|
|
|
|
|
17
|
return bless{}, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub host { |
14
|
1
|
|
|
1
|
0
|
1189
|
return '127.0.0.1'; # localhost |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub docker_run { |
18
|
1
|
|
|
1
|
0
|
2671
|
my ($self, $ports, $image_tag) = @_; |
19
|
1
|
|
|
|
|
8
|
my $container_id = docker(qw/run -d -t/, @$ports, $image_tag); |
20
|
1
|
|
|
|
|
820
|
return $container_id; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub docker_port { |
24
|
1
|
|
|
1
|
0
|
2952
|
my ($self, $container_id, $container_port) = @_; |
25
|
1
|
|
|
|
|
5
|
my $port_info = docker('port', $container_id, $container_port); |
26
|
1
|
|
|
|
|
739
|
my (undef, $port) = split ':', $port_info; |
27
|
1
|
|
|
|
|
3
|
return $port; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub on_destroy { |
31
|
1
|
|
|
1
|
0
|
2858
|
my ($self, $container_id) = @_; |
32
|
1
|
|
|
|
|
5
|
for my $subcommand ( qw/kill rm/ ) { |
33
|
2
|
|
|
|
|
19196
|
docker($subcommand, $container_id); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |