diff options
author | Gaƫtan <36162164+gaetanfl@users.noreply.github.com> | 2021-11-05 14:56:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 14:56:11 +0100 |
commit | 0f0259c91faa37ec6c7e7d89cc47f41ca065a244 (patch) | |
tree | 6b72a0b81d703556efb5fca4807b535ef19543de | |
parent | a9a36e35be18c8c3ef078a13120974b316d2a8d4 (diff) | |
parent | ce8b31deb2249adb4874f0eaafa94fbbc2393446 (diff) | |
download | ansible-rundeck-jobs-0f0259c91faa37ec6c7e7d89cc47f41ca065a244.tar.gz ansible-rundeck-jobs-0f0259c91faa37ec6c7e7d89cc47f41ca065a244.tar.zst ansible-rundeck-jobs-0f0259c91faa37ec6c7e7d89cc47f41ca065a244.zip |
Merge pull request #9 from gaetanfl/tests
setup basic tests
-rw-r--r-- | .github/workflows/pr.yml | 35 | ||||
-rw-r--r-- | tests/inventory | 3 | ||||
-rw-r--r-- | tests/requirements.txt | 2 | ||||
-rw-r--r-- | tests/rundeck_files/test.yaml | 13 | ||||
-rw-r--r-- | tests/test.yml | 10 | ||||
-rw-r--r-- | tests/tokens.properties | 1 |
6 files changed, 57 insertions, 7 deletions
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..fed51c4 --- /dev/null +++ b/.github/workflows/pr.yml | |||
@@ -0,0 +1,35 @@ | |||
1 | name: Test PR | ||
2 | on: | ||
3 | push: | ||
4 | branches: | ||
5 | - master | ||
6 | pull_request: | ||
7 | branches: | ||
8 | - master | ||
9 | jobs: | ||
10 | tests: | ||
11 | runs-on: ubuntu-latest | ||
12 | services: | ||
13 | rundeck: | ||
14 | image: rundeck/rundeck:3.4.3 | ||
15 | ports: | ||
16 | - 4440:4440 | ||
17 | env: | ||
18 | RUNDECK_TOKENS_FILE: /tokens.properties | ||
19 | volumes: | ||
20 | - ${{ github.workspace }}/test/tokens.properties:/tokens.properties | ||
21 | options: >- | ||
22 | --health-interval=10s | ||
23 | --health-cmd="wget -t 1 -q -O /dev/null http://localhost:4440" | ||
24 | --health-timeout 5s | ||
25 | --health-retries 15 | ||
26 | |||
27 | steps: | ||
28 | - uses: actions/checkout@v2 | ||
29 | - run: | | ||
30 | apt update && apt install -y python3-pip wait-for-it | ||
31 | pip3 install -r requirements.txt | ||
32 | pip3 install -r tests/requirements.txt | ||
33 | - run: http localhost:4440/api/26/projects name=test X-Rundeck-Auth-Token:testtoken Accept:application/json | ||
34 | - run: | | ||
35 | cd tests && ansible-playbook -i inventory test.yml | ||
diff --git a/tests/inventory b/tests/inventory index 878877b..2302eda 100644 --- a/tests/inventory +++ b/tests/inventory | |||
@@ -1,2 +1 @@ | |||
1 | localhost | localhost ansible_connection=local | |
2 | |||
diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..3f27cc4 --- /dev/null +++ b/tests/requirements.txt | |||
@@ -0,0 +1,2 @@ | |||
1 | httpie | ||
2 | ansible | ||
diff --git a/tests/rundeck_files/test.yaml b/tests/rundeck_files/test.yaml new file mode 100644 index 0000000..19fe18d --- /dev/null +++ b/tests/rundeck_files/test.yaml | |||
@@ -0,0 +1,13 @@ | |||
1 | - defaultTab: summary | ||
2 | description: Test job | ||
3 | executionEnabled: true | ||
4 | loglevel: INFO | ||
5 | name: Test job 2 | ||
6 | nodeFilterEditable: false | ||
7 | scheduleEnabled: true | ||
8 | sequence: | ||
9 | commands: | ||
10 | - exec: "false" | ||
11 | keepgoing: false | ||
12 | strategy: node-first | ||
13 | |||
diff --git a/tests/test.yml b/tests/test.yml index 25ef811..5d85628 100644 --- a/tests/test.yml +++ b/tests/test.yml | |||
@@ -1,8 +1,8 @@ | |||
1 | --- | 1 | --- |
2 | - hosts: localhost | 2 | - hosts: localhost |
3 | roles: | 3 | roles: |
4 | - role: ansible-rundeck-jobs | 4 | - role: ../../ansible-rundeck-jobs |
5 | rundeck_api_url: https://rundeck.example.org | 5 | rundeck_api_url: http://localhost:4440/api |
6 | rundeck_project: Test | 6 | rundeck_project: test |
7 | rundeck_api_token: token | 7 | rundeck_api_token: testtoken |
8 | rundeck_jobs_path: tests/rundeck_files | 8 | rundeck_jobs_path: rundeck_files |
diff --git a/tests/tokens.properties b/tests/tokens.properties new file mode 100644 index 0000000..3f44bf8 --- /dev/null +++ b/tests/tokens.properties | |||
@@ -0,0 +1 @@ | |||
admin: testtoken, admin | |||