Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LegenJCdary committed Mar 30, 2022
1 parent 60eee85 commit c72918b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
16 changes: 13 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- run:
command: dnf install -y epel-release
- run:
command: dnf install -y ansible python3 python3-pip
command: dnf install -y ansible python3 python3-pip e2fsprogs
- checkout
- run:
name: "Install ansible-deployer"
Expand All @@ -35,13 +35,23 @@ jobs:
command: |
./tests/01-test_argument_parsing.sh
./tests/02-checkrun.sh
- run:
name: "Workdir not writable prep"
command: |
mkdir /tmp/workdir
chown nobody:nobody /tmp/workdir
chmod 0400 /tmp/workdir
- run:
name: "Workdir not writable tests"
command: |
./tests/04-invalid_configs_p2.sh
- run:
name: "Create incompatible config file"
command: cp ./tests/files/incompatible_config.yml /etc/ansible-deploy
- run:
name: "Run shell script for invalid config tests"
name: "Workdir not readable tests"
command: |
./tests/03-invalid_configs.sh
./tests/05-invalid_configs_p3.sh
install_and_exec:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
Expand Down
4 changes: 3 additions & 1 deletion tests/03-invalid_configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

source ./tests/testing_lib.sh

check_message_in_output 'ansible-deployer run -t task_exec_bin_true -s prod -i testInfra' '\[CRITICAL\]: Config files with different extensions (.yml and .yaml) are not allowed in conf dir'
ls -ld /tmp/workdir
ansible-deployer run -t task_exec_bin_true -s prod -i testInfra -d

check_message_in_output 'ansible-deployer run -t task_exec_bin_true -s prod -i testInfra' '\[CRITICAL\]: Failed to list work dir due to'
8 changes: 8 additions & 0 deletions tests/04-invalid_configs_p2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -l


source ./tests/testing_lib.sh

ansible-deployer run -t task_exec_bin_true -s prod -i testInfra -d

check_message_in_output 'ansible-deployer run -t task_exec_bin_true -s prod -i testInfra' '\[CRITICAL\]: Failed to create work dir'
6 changes: 6 additions & 0 deletions tests/05-invalid_configs_p3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -l


source ./tests/testing_lib.sh

check_message_in_output 'ansible-deployer run -t task_exec_bin_true -s prod -i testInfra' '\[CRITICAL\]: Config files with different extensions (.yml and .yaml) are not allowed in conf dir'
7 changes: 7 additions & 0 deletions tests/files/ansible-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
global_paths:
work_dir: "/tmp/workdir"
config_dir: "/etc/ansible-deploy"

file_naming:
log_file_name_frmt: "ansible-deploy_execution_{}.log"
sequence_prefix: "SEQ"

0 comments on commit c72918b

Please sign in to comment.