From 69132007c0a1352d8157bb54280965587b0fc4da Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 23 Jan 2018 10:54:25 -0800 Subject: [PATCH] Revert "Move requirements into tests. (#35197)" This reverts commit 4f6017dc1629361cce6fa3e2e035a4710550db9e. --- .../targets/command_shell/tasks/main.yml | 12 +++++++++--- test/integration/targets/copy/tasks/tests.yml | 6 +++++- test/integration/targets/gem/tasks/main.yml | 16 ---------------- test/integration/targets/gem/vars/FreeBSD.yml | 3 --- test/integration/targets/gem/vars/RedHat.yml | 2 -- test/integration/targets/gem/vars/default.yml | 1 - test/integration/targets/git/tasks/setup.yml | 5 ----- test/integration/targets/hg/tasks/main.yml | 5 ----- test/integration/targets/pull/runme.sh | 2 -- test/integration/targets/pull/setup.yml | 6 ------ .../targets/subversion/tasks/main.yml | 5 ----- .../targets/synchronize/tasks/main.yml | 5 ----- test/runner/setup/remote.sh | 12 ++++++++++++ 13 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 test/integration/targets/gem/vars/FreeBSD.yml delete mode 100644 test/integration/targets/gem/vars/RedHat.yml delete mode 100644 test/integration/targets/gem/vars/default.yml delete mode 100644 test/integration/targets/pull/setup.yml diff --git a/test/integration/targets/command_shell/tasks/main.yml b/test/integration/targets/command_shell/tasks/main.yml index 858f07d1a8b..b8d54381874 100644 --- a/test/integration/targets/command_shell/tasks/main.yml +++ b/test/integration/targets/command_shell/tasks/main.yml @@ -100,6 +100,10 @@ shell: which bash register: bash +- name: locate sha1sum/shasum + shell: which sha1sum || which shasum + register: sha1sum + ## ## command ## @@ -192,7 +196,7 @@ - "command_result5.stdout == 'foobar'" - name: send to stdin literal multiline block - command: "{{ ansible_python_interpreter }} -c 'import hashlib, sys; print(hashlib.sha1((sys.stdin.buffer if hasattr(sys.stdin, \"buffer\") else sys.stdin).read()).hexdigest())'" + command: "{{ sha1sum.stdout }}" args: stdin: |- this is the first line @@ -205,7 +209,7 @@ - name: assert the multiline input was passed correctly assert: that: - - "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903'" + - "command_result6.stdout == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903 -'" ## ## shell @@ -274,7 +278,9 @@ "multiline echo" \ "with a new line in quotes" \ - | {{ ansible_python_interpreter }} -c 'import hashlib, sys; print(hashlib.sha1((sys.stdin.buffer if hasattr(sys.stdin, "buffer") else sys.stdin).read()).hexdigest())' + | {{ sha1sum.stdout }} \ + | tr -s ' ' \ + | cut -f1 -d ' ' echo "this is a second line" register: shell_result5 diff --git a/test/integration/targets/copy/tasks/tests.yml b/test/integration/targets/copy/tasks/tests.yml index 43a763ea143..2784febe807 100644 --- a/test/integration/targets/copy/tasks/tests.yml +++ b/test/integration/targets/copy/tasks/tests.yml @@ -9,6 +9,10 @@ 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 @@ -1123,7 +1127,7 @@ - stat_link_result.stat.islnk - name: Get the checksum of the link target - shell: "{{ ansible_python_interpreter }} -c 'import hashlib; print(hashlib.sha1(open(\"{{remote_dir | expanduser}}/follow_test\", \"rb\").read()).hexdigest())'" + shell: "{{ sha1sum.stdout }} {{remote_dir}}/follow_test | cut -f1 -sd ' '" register: target_file_result - name: Assert that the link target was updated diff --git a/test/integration/targets/gem/tasks/main.yml b/test/integration/targets/gem/tasks/main.yml index 77b93e663da..adf76d7c335 100644 --- a/test/integration/targets/gem/tasks/main.yml +++ b/test/integration/targets/gem/tasks/main.yml @@ -16,22 +16,6 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -- 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 diff --git a/test/integration/targets/gem/vars/FreeBSD.yml b/test/integration/targets/gem/vars/FreeBSD.yml deleted file mode 100644 index 84e0b483d58..00000000000 --- a/test/integration/targets/gem/vars/FreeBSD.yml +++ /dev/null @@ -1,3 +0,0 @@ -test_packages: - - "devel/ruby-gems" - - "ruby" diff --git a/test/integration/targets/gem/vars/RedHat.yml b/test/integration/targets/gem/vars/RedHat.yml deleted file mode 100644 index c044d109b68..00000000000 --- a/test/integration/targets/gem/vars/RedHat.yml +++ /dev/null @@ -1,2 +0,0 @@ -test_packages: - - "rubygems" diff --git a/test/integration/targets/gem/vars/default.yml b/test/integration/targets/gem/vars/default.yml deleted file mode 100644 index 7d6e61ac469..00000000000 --- a/test/integration/targets/gem/vars/default.yml +++ /dev/null @@ -1 +0,0 @@ -test_packages: [] diff --git a/test/integration/targets/git/tasks/setup.yml b/test/integration/targets/git/tasks/setup.yml index 8fdb2a401c7..588d99c99c4 100644 --- a/test/integration/targets/git/tasks/setup.yml +++ b/test/integration/targets/git/tasks/setup.yml @@ -8,11 +8,6 @@ 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 diff --git a/test/integration/targets/hg/tasks/main.yml b/test/integration/targets/hg/tasks/main.yml index 14719a6ce6d..f9c1b1494bf 100644 --- a/test/integration/targets/hg/tasks/main.yml +++ b/test/integration/targets/hg/tasks/main.yml @@ -25,11 +25,6 @@ - name: clean out the 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 shell: which hg diff --git a/test/integration/targets/pull/runme.sh b/test/integration/targets/pull/runme.sh index 0ad9e01ba97..7334df93ca5 100755 --- a/test/integration/targets/pull/runme.sh +++ b/test/integration/targets/pull/runme.sh @@ -11,8 +11,6 @@ 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}" ( diff --git a/test/integration/targets/pull/setup.yml b/test/integration/targets/pull/setup.yml deleted file mode 100644 index 581902474d4..00000000000 --- a/test/integration/targets/pull/setup.yml +++ /dev/null @@ -1,6 +0,0 @@ -- hosts: localhost - tasks: - - name: install git - package: - name: git - when: ansible_distribution != "MacOSX" diff --git a/test/integration/targets/subversion/tasks/main.yml b/test/integration/targets/subversion/tasks/main.yml index 5631adbd892..3f89c236eb2 100644 --- a/test/integration/targets/subversion/tasks/main.yml +++ b/test/integration/targets/subversion/tasks/main.yml @@ -25,11 +25,6 @@ - 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 diff --git a/test/integration/targets/synchronize/tasks/main.yml b/test/integration/targets/synchronize/tasks/main.yml index 80e052a6a30..5913762183e 100644 --- a/test/integration/targets/synchronize/tasks/main.yml +++ b/test/integration/targets/synchronize/tasks/main.yml @@ -16,11 +16,6 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -- name: install rsync - package: - name: rsync - when: ansible_distribution != "MacOSX" - - name: cleanup old files shell: rm -rf {{output_dir}}/* diff --git a/test/runner/setup/remote.sh b/test/runner/setup/remote.sh index d8d2a7707ec..2b83056c81c 100644 --- a/test/runner/setup/remote.sh +++ b/test/runner/setup/remote.sh @@ -14,9 +14,16 @@ 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 @@ -27,10 +34,15 @@ 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