Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
822be307
Commit
822be307
authored
Feb 19, 2014
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic skeleton of tests for pip.
parent
90cf1c79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
1 deletions
+89
-1
tests_new/integration/destructive.yml
+2
-1
tests_new/integration/roles/test_pip/meta/main.yml
+3
-0
tests_new/integration/roles/test_pip/tasks/main.yml
+84
-0
No files found.
tests_new/integration/destructive.yml
View file @
822be307
-
hosts
:
testhost
gather_facts
:
True
roles
:
[]
roles
:
-
{
role
:
test_pip
,
tags
:
test_pip
}
tests_new/integration/roles/test_pip/meta/main.yml
0 → 100644
View file @
822be307
dependencies
:
-
prepare_tests
tests_new/integration/roles/test_pip/tasks/main.yml
0 → 100644
View file @
822be307
# test code for the pip module
# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# FIXME: replace the python test package
# first some tests installed system-wide
# verify things were not installed to start with
-
name
:
ensure a package is not installed (precondition setup)
pip
:
name={{ pip_test_package }} state=absent
# verify that a package that is uninstalled being set to absent
# results in an unchanged state and that the test package is not
# installed
-
name
:
ensure a package is not installed
pip
:
name={{ pip_test_package }} state=absent
register
:
uninstall_result
-
debug
:
var=installed_result
-
name
:
removing an unremoved package should return unchanged
assert
:
that
:
-
"
not
uninstall_result.changed"
-
shell
:
"
python
-c
'import
{{
pip_test_package
}}'"
register
:
absent_result
ignore_errors
:
True
-
name
:
verify {{ pip_test_package }} is not present
assert
:
that
:
-
"
absent_result.rc
!=
0"
# now we're going to install the test package knowing it is uninstalled
# and check that installation was ok
-
name
:
ensure a package is installed
pip
:
name={{ pip_test_package }} state=present
register
:
install_result
-
name
:
verify we recorded a change
assert
:
that
:
-
"
install_result.changed
==
True"
-
shell
:
"
python
-c
'import
{{
pip_test_package
}}'"
register
:
installed_result
# now remove it to test uninstallation of a package we are sure is installed
-
name
:
now uninstall so we can see that a change occured
pip
:
name={{ pip_test_package }} state=absent
register
:
absent2
-
name
:
assert a change occured on uninstallation
assert
:
that
:
-
"
absent2.changed"
# put the test package back
-
name
:
now put it back in case someone wanted it (like us!)
pip
:
name={{ pip_test_package }} state=present
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment