]> git.immae.eu Git - github/fretlink/ansible-rundeck-jobs.git/commitdiff
setup basic tests 9/head
authorGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>
Fri, 5 Nov 2021 10:08:53 +0000 (11:08 +0100)
committerGaëtan Duchaussois <gaetan.duchaussois@fretlink.com>
Fri, 5 Nov 2021 13:47:16 +0000 (14:47 +0100)
.github/workflows/pr.yml [new file with mode: 0644]
tests/inventory
tests/requirements.txt [new file with mode: 0644]
tests/rundeck_files/test.yaml [new file with mode: 0644]
tests/test.yml
tests/tokens.properties [new file with mode: 0644]

diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
new file mode 100644 (file)
index 0000000..fed51c4
--- /dev/null
@@ -0,0 +1,35 @@
+name: Test PR
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    branches:
+      - master
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    services:
+      rundeck:
+        image: rundeck/rundeck:3.4.3
+        ports:
+          - 4440:4440
+        env:
+          RUNDECK_TOKENS_FILE: /tokens.properties
+        volumes:
+          - ${{ github.workspace }}/test/tokens.properties:/tokens.properties
+        options: >-
+          --health-interval=10s
+          --health-cmd="wget -t 1 -q -O /dev/null http://localhost:4440"
+          --health-timeout 5s
+          --health-retries 15
+
+    steps:
+      - uses: actions/checkout@v2
+      - run: |
+          apt update && apt install -y python3-pip wait-for-it
+          pip3 install -r requirements.txt
+          pip3 install -r tests/requirements.txt
+      - run: http localhost:4440/api/26/projects name=test X-Rundeck-Auth-Token:testtoken Accept:application/json
+      - run: |
+          cd tests && ansible-playbook -i inventory test.yml
index 878877b0776c44f55fc4e458f70840f31da5bb01..2302edae31b44da92e28582707b403fd7ad1342e 100644 (file)
@@ -1,2 +1 @@
-localhost
-
+localhost ansible_connection=local
diff --git a/tests/requirements.txt b/tests/requirements.txt
new file mode 100644 (file)
index 0000000..3f27cc4
--- /dev/null
@@ -0,0 +1,2 @@
+httpie
+ansible
diff --git a/tests/rundeck_files/test.yaml b/tests/rundeck_files/test.yaml
new file mode 100644 (file)
index 0000000..19fe18d
--- /dev/null
@@ -0,0 +1,13 @@
+- defaultTab: summary
+  description: Test job 
+  executionEnabled: true
+  loglevel: INFO
+  name: Test job 2
+  nodeFilterEditable: false
+  scheduleEnabled: true
+  sequence:
+    commands:
+    - exec: "false" 
+    keepgoing: false
+    strategy: node-first
+
index 25ef81142526089fd62093b94d0ac735ef12917c..5d856289a2435a12fd9e762f0516e653644a4b18 100644 (file)
@@ -1,8 +1,8 @@
 ---
 - hosts: localhost
   roles:
-    - role: ansible-rundeck-jobs
-      rundeck_api_url: https://rundeck.example.org 
-      rundeck_project: Test
-      rundeck_api_token: token 
-      rundeck_jobs_path: tests/rundeck_files 
+    - role: ../../ansible-rundeck-jobs
+      rundeck_api_url: http://localhost:4440/api
+      rundeck_project: test
+      rundeck_api_token: testtoken 
+      rundeck_jobs_path: rundeck_files 
diff --git a/tests/tokens.properties b/tests/tokens.properties
new file mode 100644 (file)
index 0000000..3f44bf8
--- /dev/null
@@ -0,0 +1 @@
+admin: testtoken, admin