Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) Add some new optional parameters for puppetserver testing #65

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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