mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 22:33:25 +00:00
Add more tests for private docker registries
This commit is contained in:
@@ -33,3 +33,34 @@
|
||||
assert:
|
||||
that:
|
||||
- "'hello world' in docker_output.stdout_lines"
|
||||
|
||||
- name: Run a script that sets environment in busybox
|
||||
docker:
|
||||
image: busybox
|
||||
state: reloaded
|
||||
pull: always
|
||||
env:
|
||||
TEST: hello
|
||||
command: '/bin/sh -c "nc -l -p 2000 -e xargs -n1 echo $TEST"'
|
||||
detach: True
|
||||
|
||||
- name: Get the docker container id
|
||||
shell: "docker ps | grep busybox | awk '{ print $1 }'"
|
||||
register: container_id
|
||||
|
||||
- name: Get the docker container ip
|
||||
shell: "docker inspect {{ container_id.stdout_lines[0] }} | grep IPAddress | awk -F '\"' '{ print $4 }'"
|
||||
register: container_ip
|
||||
|
||||
- name: Try to access the server
|
||||
shell: "echo 'world' | nc {{ container_ip.stdout_lines[0] }} 2000"
|
||||
register: docker_output
|
||||
|
||||
- name: check that the script ran
|
||||
assert:
|
||||
that:
|
||||
- "'hello world' in docker_output.stdout_lines"
|
||||
|
||||
- name: Remove the busybox image from the local docker
|
||||
shell: "docker rmi -f busybox"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user