Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move requirements into tests. #35885

Merged
merged 2 commits into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/integration/targets/ansible-galaxy/aliases
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
destructive
posix/ci/group3
2 changes: 2 additions & 0 deletions test/integration/targets/ansible-galaxy/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -eux -o pipefail

ansible-playbook setup.yml

# Need a relative custom roles path for testing various scenarios of -p
galaxy_relative_rolespath="my/custom/roles/path"

Expand Down
6 changes: 6 additions & 0 deletions test/integration/targets/ansible-galaxy/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: localhost
tasks:
- name: install git
package:
name: git
when: ansible_distribution != "MacOSX"
12 changes: 3 additions & 9 deletions test/integration/targets/command_shell/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@
shell: which bash
register: bash

- name: locate sha1sum/shasum
shell: which sha1sum || which shasum
register: sha1sum

##
## command
##
Expand Down Expand Up @@ -196,7 +192,7 @@
- "command_result5.stdout == 'foobar'"

- 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:
stdin: |-
this is the first line
Expand All @@ -209,7 +205,7 @@
- name: assert the multiline input was passed correctly
assert:
that:
- "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903 -'"
- "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903'"

##
## shell
Expand Down Expand Up @@ -278,9 +274,7 @@
"multiline echo" \
"with a new line
in quotes" \
| {{ sha1sum.stdout }} \
| tr -s ' ' \
| cut -f1 -d ' '
| {{ ansible_python_interpreter }} -c 'import hashlib, sys; print(hashlib.sha1((sys.stdin.buffer if hasattr(sys.stdin, "buffer") else sys.stdin).read()).hexdigest())'
echo "this is a second line"
register: shell_result5

Expand Down
6 changes: 1 addition & 5 deletions test/integration/targets/copy/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
set_fact:
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
copy:
src: foo.txt
Expand Down Expand Up @@ -1127,7 +1123,7 @@
- stat_link_result.stat.islnk

- 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

- name: Assert that the link target was updated
Expand Down
16 changes: 16 additions & 0 deletions test/integration/targets/gem/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
# You should have received a copy of the GNU General Public License
# 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
gem: name=gist state=absent

Expand Down
3 changes: 3 additions & 0 deletions test/integration/targets/gem/vars/FreeBSD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_packages:
- "devel/ruby-gems"
- "ruby"
2 changes: 2 additions & 0 deletions test/integration/targets/gem/vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test_packages:
- "rubygems"
1 change: 1 addition & 0 deletions test/integration/targets/gem/vars/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_packages: []
5 changes: 5 additions & 0 deletions test/integration/targets/git/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
path: "{{ output_dir }}"
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
shell: which git

Expand Down
2 changes: 2 additions & 0 deletions test/integration/targets/pull/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ repo_dir="${temp_dir}/repo"
pull_dir="${temp_dir}/pull"
temp_log="${temp_dir}/pull.log"

ansible-playbook setup.yml

cp -av "pull-integration-test" "${repo_dir}"
cd "${repo_dir}"
(
Expand Down
6 changes: 6 additions & 0 deletions test/integration/targets/pull/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: localhost
tasks:
- name: install git
package:
name: git
when: ansible_distribution != "MacOSX"
5 changes: 5 additions & 0 deletions test/integration/targets/subversion/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
- name: clean out the 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
shell: which svn

Expand Down
5 changes: 5 additions & 0 deletions test/integration/targets/synchronize/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# You should have received a copy of the GNU General Public License
# 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
shell: rm -rf {{output_dir}}/*

Expand Down
12 changes: 0 additions & 12 deletions test/runner/setup/remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@ if [ "${platform}" = "freebsd" ]; then
pkg install -y \
bash \
curl \
devel/ruby-gems \
git \
gtar \
mercurial \
python \
rsync \
ruby \
subversion \
sudo \
zip \
&& break
echo "Failed to install packages. Sleeping before trying again..."
sleep 10
Expand All @@ -34,15 +27,10 @@ elif [ "${platform}" = "rhel" ]; then
while true; do
yum install -y \
gcc \
git \
mercurial \
python-devel \
python-jinja2 \
python-virtualenv \
python2-cryptography \
rubygems \
subversion \
unzip \
&& break
echo "Failed to install packages. Sleeping before trying again..."
sleep 10
Expand Down