Skip to content

Commit f757e69

Browse files
committed
CI: Add integration test job to pull request workflow
1 parent b1a78bd commit f757e69

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,24 @@ jobs:
3232
- name: Linting code
3333
run: |
3434
ansible-lint -v --force-color
35+
36+
integration:
37+
runs-on: ubuntu-latest
38+
steps:
39+
# Checks-out the repository under $GITHUB_WORKSPACE, so it's accessible to the job
40+
- uses: actions/checkout@v2
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install ansible==5.*
46+
ansible-galaxy collection install git+file://$(pwd)
47+
48+
- name: Run Pulp in one
49+
run: |
50+
tests/pulp-in-one.sh
51+
52+
# TODO: Use ansible-test to run these.
53+
- name: Running integration tests
54+
run: |
55+
ansible-playbook -v tests/*.yml

tests/pulp-in-one.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# Run a Pulp in one container, and reset the admin password to 'password'.
4+
# Use only for testing!
5+
6+
set -eu
7+
set -o pipefail
8+
9+
mkdir -p settings
10+
11+
cat << EOF > settings/settings.py
12+
CONTENT_ORIGIN='http://$(hostname):8080'
13+
ANSIBLE_API_HOSTNAME='http://$(hostname):8080'
14+
ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content'
15+
TOKEN_AUTH_DISABLED=True
16+
EOF
17+
18+
# Run Pulp in one container.
19+
docker run \
20+
--detach \
21+
--name pulp \
22+
--volume "$(pwd)/settings":/etc/pulp \
23+
--publish 8080:80 \
24+
pulp/pulp:latest
25+
26+
# Wait for it to come up.
27+
attempts=0
28+
until curl --fail http://localhost:8080/pulp/api/v3/status/ > /dev/null 2>&1; do
29+
sleep 2
30+
attempts=$((attempts + 1))
31+
if [[ $attempts -ge 60 ]]; then
32+
echo "Timed out waiting for pulp"
33+
docker logs pulp
34+
exit 1
35+
fi
36+
done
37+
38+
# Reset the admin password.
39+
docker exec pulp pulpcore-manager reset-admin-password --password password

0 commit comments

Comments
 (0)