Setup assertions, run them after the installation

This commit is contained in:
Paul Montero
2017-09-19 15:09:22 -05:00
parent 16c7ea351a
commit 7190ce1864
3 changed files with 50 additions and 1 deletions

35
tests/post_tasks.yml Normal file
View File

@@ -0,0 +1,35 @@
---
post_tasks:
- name: Check that ruby exists
command: ruby -v
register: check_ruby
- assert:
that:
- "check_ruby == 'ruby'"
- "check_ruby.rc == 0 "
msg: No ruby test pass
- name: Check default ruby
shell: ~/.rvm/wrappers/default/ruby -v | cut -c1-10
register: check_ruby_default
- assert:
that:
- "check_ruby_default.stdout == 'ruby 2.3.1'"
msg: Default ruby test pass
- name: Check multiple rubies
command: ls ~/.rvm/rubies
register: check_ruby_multiple
- assert:
that:
- "ruby-2.2.5' in check_ruby_multiple.stdout"
- "ruby-2.3.1' in check_ruby_multiple.stdout"
msg: Multiple rubies test pass
- name: Check bundler symlinked on system path
shell: ls ~/.rvm/wrappers/default/ |grep 'bundler'
register: check_ruby_bundler
- assert:
that:
- "check_ruby_bundler.stdout == 'bundler' "
msg: Bundler symlinked on system path test pass

View File

@@ -4,9 +4,16 @@
vars:
rvm1_user: root
rvm1_install_flags: '--auto-dotfiles'
rvm1_install_path: '/home/{{ rvm1_user }}/.rvm'
rvm1_rubies:
- 'ruby-2.2.5'
- 'ruby-2.3.1'
rvm1_install_path: '/home/{{ rvm1_user }}/.rvm'
roles:
- role: rvm1-ansible
# Asserts tasks
- hosts: all
gather_facts: false
tasks:
- name: Assert tasks
include: assertetions.yml

View File

@@ -10,3 +10,10 @@
roles:
- role: rvm1-ansible
become: yes
# Asserts tasks
- hosts: all
gather_facts: false
tasks:
- name: Assert tasks
include: assertions.yml