Skip to content

Commit 43ba7fd

Browse files
authored
Merge pull request #267 from puppetlabs/healthcheck_windows
testing windows healthcheck cmd
2 parents 5cf3677 + b9831eb commit 43ba7fd

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

manifests/run.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
$exec_path = ['c:/Windows/Temp/', 'C:/Program Files/Docker/']
217217
$exec_provider = 'powershell'
218218
$cidfile = "c:/Windows/Temp/${service_prefix}${sanitised_title}.cid"
219+
$restart_check = "${docker_command} inspect ${sanitised_title} -f '{{ if eq \"unhealthy\" .State.Health.Status }} {{ .Name }}{{ end }}' | findstr ${sanitised_title}"
219220
} else {
220221
$exec_environment = 'HOME=/root'
221222
$exec_path = ['/bin', '/usr/bin']

spec/defines/run_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@
579579
context 'with restart policy set to no' do
580580
let(:params) { {'restart' => 'no', 'command' => 'command', 'image' => 'base', 'extra_parameters' => '-c 4'} }
581581
it { should contain_exec('run sample with docker') }
582-
it { should contain_exec('run sample with docker').with_unless(/\/var\/run\/docker-sample.cid/) }
583-
it { should contain_exec('run sample with docker').with_unless(/-a/) }
582+
it { should contain_exec('run sample with docker').with_unless(/sample/) }
583+
it { should contain_exec('run sample with docker').with_unless(/inspect/) }
584584
it { should contain_exec('run sample with docker').with_command(/--cidfile=\/var\/run\/docker-sample.cid/) }
585585
it { should contain_exec('run sample with docker').with_command(/-c 4/) }
586586
it { should contain_exec('run sample with docker').with_command(/--restart="no"/) }
@@ -591,8 +591,8 @@
591591
context 'with restart policy set to always' do
592592
let(:params) { {'restart' => 'always', 'command' => 'command', 'image' => 'base', 'extra_parameters' => '-c 4'} }
593593
it { should contain_exec('run sample with docker') }
594-
it { should contain_exec('run sample with docker').with_unless(/\/var\/run\/docker-sample.cid/) }
595-
it { should contain_exec('run sample with docker').with_unless(/-a/) }
594+
it { should contain_exec('run sample with docker').with_unless(/sample/) }
595+
it { should contain_exec('run sample with docker').with_unless(/inspect/) }
596596
it { should contain_exec('run sample with docker').with_command(/--cidfile=\/var\/run\/docker-sample.cid/) }
597597
it { should contain_exec('run sample with docker').with_command(/-c 4/) }
598598
it { should contain_exec('run sample with docker').with_command(/--restart="always"/) }
@@ -603,8 +603,8 @@
603603
context 'with restart policy set to on-failure' do
604604
let(:params) { {'restart' => 'on-failure', 'command' => 'command', 'image' => 'base', 'extra_parameters' => '-c 4'} }
605605
it { should contain_exec('run sample with docker') }
606-
it { should contain_exec('run sample with docker').with_unless(/\/var\/run\/docker-sample.cid/) }
607-
it { should contain_exec('run sample with docker').with_unless(/-a/) }
606+
it { should contain_exec('run sample with docker').with_unless(/sample/) }
607+
it { should contain_exec('run sample with docker').with_unless(/inspect/) }
608608
it { should contain_exec('run sample with docker').with_command(/--cidfile=\/var\/run\/docker-sample.cid/) }
609609
it { should contain_exec('run sample with docker').with_command(/-c 4/) }
610610
it { should contain_exec('run sample with docker').with_command(/--restart="on-failure"/) }
@@ -615,8 +615,8 @@
615615
context 'with restart policy set to on-failure:3' do
616616
let(:params) { {'restart' => 'on-failure:3', 'command' => 'command', 'image' => 'base', 'extra_parameters' => '-c 4'} }
617617
it { should contain_exec('run sample with docker') }
618-
it { should contain_exec('run sample with docker').with_unless(/\/var\/run\/docker-sample.cid/) }
619-
it { should contain_exec('run sample with docker').with_unless(/-a/) }
618+
it { should contain_exec('run sample with docker').with_unless(/sample/) }
619+
it { should contain_exec('run sample with docker').with_unless(/inspect/) }
620620
it { should contain_exec('run sample with docker').with_command(/--cidfile=\/var\/run\/docker-sample.cid/) }
621621
it { should contain_exec('run sample with docker').with_command(/-c 4/) }
622622
it { should contain_exec('run sample with docker').with_command(/--restart="on-failure:3"/) }

0 commit comments

Comments
 (0)