Skip to content

Commit

Permalink
(maint) Add some new optional parameters for puppetserver testing (#65)
Browse files Browse the repository at this point in the history
(maint) Add some new optional parameters for puppetserver testing / switch to Ubuntu agent container for testing
  • Loading branch information
Iristyle authored May 3, 2019
2 parents 49b3707 + 4deb920 commit e61abd7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions gem/lib/pupperware/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ def wait_on_puppetdb_status(seconds = 240)
# Puppetserver Helpers
######################################################################

def wait_on_puppetserver_status(seconds = 180)
def wait_on_puppetserver_status(seconds = 180, service_name = 'puppet')
# puppetserver has a healthcheck, we can let that deal with timeouts
return retry_block_up_to_timeout(seconds) do
status = get_container_status(get_service_container('puppet'))
status = get_container_status(get_service_container(service_name))
(status == 'healthy' || status == "'healthy'") ? 'healthy' :
raise("puppetserver stuck in #{status}")
end
Expand All @@ -237,11 +237,19 @@ def clean_certificate(agent_name)
# Puppet Agent Helpers
######################################################################

def run_agent(agent_name, network, server = get_container_hostname(get_service_container('puppet')))
# When testing with the `puppet/puppet-agent-alpine` image on windows
# systems with LCOW we had intermittent failures in DNS resolution that
# occurred fairly regularly. It seems to be specifically interaction
# between the base alpine (3.8 and 3.9) images with windows/LCOW.
#
# Two issues related to this issue are
# https://github.com/docker/libnetwork/issues/2371 and
# https://github.com/Microsoft/opengcs/issues/303
def run_agent(agent_name, network, server = get_container_hostname(get_service_container('puppet')), ca = get_container_hostname(get_service_container('puppet')))
# setting up a Windows TTY is difficult, so we don't
# allocating a TTY will show container pull output on Linux, but that's not good for tests
STDOUT.puts("running agent #{agent_name} in network #{network} against #{server}")
result = run_command("docker run --rm --network #{network} --name #{agent_name} --hostname #{agent_name} puppet/puppet-agent-alpine agent --verbose --onetime --no-daemonize --summarize --server #{server}")
result = run_command("docker run --rm --network #{network} --name #{agent_name} --hostname #{agent_name} puppet/puppet-agent-ubuntu agent --verbose --onetime --no-daemonize --summarize --server #{server} --ca_server #{ca}")
return result[:status].exitstatus
end

Expand Down

0 comments on commit e61abd7

Please sign in to comment.