Move requirements into tests. (#35197)

This commit is contained in:
Matt Clay 2018-01-23 10:08:16 -08:00 committed by GitHub
parent 060001b08d
commit 4f6017dc16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 54 additions and 26 deletions

View file

@ -100,10 +100,6 @@
shell: which bash shell: which bash
register: bash register: bash
- name: locate sha1sum/shasum
shell: which sha1sum || which shasum
register: sha1sum
## ##
## command ## command
## ##
@ -196,7 +192,7 @@
- "command_result5.stdout == 'foobar'" - "command_result5.stdout == 'foobar'"
- name: send to stdin literal multiline block - name: send to stdin literal multiline block
command: "{{ sha1sum.stdout }}" command: "{{ ansible_python_interpreter }} -c 'import hashlib, sys; print(hashlib.sha1((sys.stdin.buffer if hasattr(sys.stdin, \"buffer\") else sys.stdin).read()).hexdigest())'"
args: args:
stdin: |- stdin: |-
this is the first line this is the first line
@ -209,7 +205,7 @@
- name: assert the multiline input was passed correctly - name: assert the multiline input was passed correctly
assert: assert:
that: that:
- "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903 -'" - "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903'"
## ##
## shell ## shell
@ -278,9 +274,7 @@
"multiline echo" \ "multiline echo" \
"with a new line "with a new line
in quotes" \ in quotes" \
| {{ sha1sum.stdout }} \ | {{ ansible_python_interpreter }} -c 'import hashlib, sys; print(hashlib.sha1((sys.stdin.buffer if hasattr(sys.stdin, "buffer") else sys.stdin).read()).hexdigest())'
| tr -s ' ' \
| cut -f1 -d ' '
echo "this is a second line" echo "this is a second line"
register: shell_result5 register: shell_result5

View file

@ -9,10 +9,6 @@
set_fact: set_fact:
remote_file: "{{ remote_dir }}/foo.txt" remote_file: "{{ remote_dir }}/foo.txt"
- name: Locate sha1sum/shasum
shell: which sha1sum || which shasum
register: sha1sum
- name: Initiate a basic copy, and also test the mode - name: Initiate a basic copy, and also test the mode
copy: copy:
src: foo.txt src: foo.txt
@ -1127,7 +1123,7 @@
- stat_link_result.stat.islnk - stat_link_result.stat.islnk
- name: Get the checksum of the link target - name: Get the checksum of the link target
shell: "{{ sha1sum.stdout }} {{remote_dir}}/follow_test | cut -f1 -sd ' '" shell: "{{ ansible_python_interpreter }} -c 'import hashlib; print(hashlib.sha1(open(\"{{remote_dir | expanduser}}/follow_test\", \"rb\").read()).hexdigest())'"
register: target_file_result register: target_file_result
- name: Assert that the link target was updated - name: Assert that the link target was updated

View file

@ -16,6 +16,22 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_os_family }}.yml'
- 'default.yml'
paths: '../vars'
- name: install dependencies for test
package: name={{ package_item }} state=present
with_items: "{{ test_packages }}"
loop_control:
loop_var: package_item
when: ansible_distribution != "MacOSX"
- name: remove a gem - name: remove a gem
gem: name=gist state=absent gem: name=gist state=absent

View file

@ -0,0 +1,3 @@
test_packages:
- "devel/ruby-gems"
- "ruby"

View file

@ -0,0 +1,2 @@
test_packages:
- "rubygems"

View file

@ -0,0 +1 @@
test_packages: []

View file

@ -8,6 +8,11 @@
path: "{{ output_dir }}" path: "{{ output_dir }}"
state: directory state: directory
- name: SETUP | install git
package:
name: git
when: ansible_distribution != "MacOSX"
- name: SETUP | verify that git is installed so this test can continue - name: SETUP | verify that git is installed so this test can continue
shell: which git shell: which git

View file

@ -25,6 +25,11 @@
- name: clean out the output_dir - name: clean out the output_dir
shell: rm -rf {{ output_dir }}/* shell: rm -rf {{ output_dir }}/*
- name: install mercurial
package:
name: mercurial
when: ansible_distribution != "MacOSX"
- name: verify that mercurial is installed so this test can continue - name: verify that mercurial is installed so this test can continue
shell: which hg shell: which hg

View file

@ -11,6 +11,8 @@ repo_dir="${temp_dir}/repo"
pull_dir="${temp_dir}/pull" pull_dir="${temp_dir}/pull"
temp_log="${temp_dir}/pull.log" temp_log="${temp_dir}/pull.log"
ansible-playbook setup.yml
cp -av "pull-integration-test" "${repo_dir}" cp -av "pull-integration-test" "${repo_dir}"
cd "${repo_dir}" cd "${repo_dir}"
( (

View file

@ -0,0 +1,6 @@
- hosts: localhost
tasks:
- name: install git
package:
name: git
when: ansible_distribution != "MacOSX"

View file

@ -25,6 +25,11 @@
- name: clean out the output_dir - name: clean out the output_dir
shell: rm -rf {{ output_dir }}/* shell: rm -rf {{ output_dir }}/*
- name: install subversion
package:
name: subversion
when: ansible_distribution != "MacOSX"
- name: verify that subversion is installed so this test can continue - name: verify that subversion is installed so this test can continue
shell: which svn shell: which svn

View file

@ -16,6 +16,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: install rsync
package:
name: rsync
when: ansible_distribution != "MacOSX"
- name: cleanup old files - name: cleanup old files
shell: rm -rf {{output_dir}}/* shell: rm -rf {{output_dir}}/*

View file

@ -14,16 +14,9 @@ if [ "${platform}" = "freebsd" ]; then
pkg install -y \ pkg install -y \
bash \ bash \
curl \ curl \
devel/ruby-gems \
git \
gtar \ gtar \
mercurial \
python \ python \
rsync \
ruby \
subversion \
sudo \ sudo \
zip \
&& break && break
echo "Failed to install packages. Sleeping before trying again..." echo "Failed to install packages. Sleeping before trying again..."
sleep 10 sleep 10
@ -34,15 +27,10 @@ elif [ "${platform}" = "rhel" ]; then
while true; do while true; do
yum install -y \ yum install -y \
gcc \ gcc \
git \
mercurial \
python-devel \ python-devel \
python-jinja2 \ python-jinja2 \
python-virtualenv \ python-virtualenv \
python2-cryptography \ python2-cryptography \
rubygems \
subversion \
unzip \
&& break && break
echo "Failed to install packages. Sleeping before trying again..." echo "Failed to install packages. Sleeping before trying again..."
sleep 10 sleep 10