-
Notifications
You must be signed in to change notification settings - Fork 72
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
Initial integration testing environment #8
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
836d871
Initial integration testing environment
ncoghlan e85a9ae
Ignore VSCode .venv directory/symlink
ncoghlan ebb54e9
Actually run migration in test suite
ncoghlan 1b00c43
Move Pipfile to project root
ncoghlan c358011
No sync dir in basic httpd VM
ncoghlan ad3f8ee
Correctly identify VM host names
ncoghlan 3dcdf09
Add script to start integration VMs
ncoghlan 79af432
Adjust leapp config and migration
ncoghlan 192fbbb
Allow macrocontainer time to start
ncoghlan ccad1b6
Specify dir to run integration tests
ncoghlan e378b3c
Update description of prototype status
ncoghlan 441ba8b
Fix Apache config error in source VM
ncoghlan bf14d4d
Fix grammar error in step wording
ncoghlan 6d8bddb
Also check for expected HTTP status
ncoghlan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.vagrant/ | ||
__pycache__/ | ||
*.pyc | ||
# Symlink to virtualenv | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[source]] | ||
url = "https://pypi.python.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
behave = "*" | ||
pylint = "*" | ||
requests = "*" | ||
PyHamcrest = "*" | ||
|
||
[packages] | ||
ansible = ">= 2.0" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Symlink to virtualenv | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Kernel modernization integration tests | ||
|
||
This directory contains integration tests that check the expected results | ||
of kernel modernization attempts given different starting scenarios. | ||
|
||
* Test scenarios and expectations are defined using the Python | ||
[behave](http://pythonhosted.org/behave/) framework | ||
* Local virtual machines for test cases are defined and configured | ||
using the | ||
[Ansible Python API](http://docs.ansible.com/ansible/dev_guide/developing_api.html) | ||
* The integration testing environment itself is configured using | ||
[pipenv](https://pypi.python.org/pypi/pipenv) | ||
|
||
## Setting up | ||
|
||
Install `vagrant` and `vagrant-libvirt`: | ||
|
||
$ sudo dnf install vagrant vagrant-libvirt | ||
|
||
Install `pipenv` and the `pew` environment management tool: | ||
|
||
$ pip install --user pipsi | ||
$ pipsi install pew | ||
$ pipsi install pipenv | ||
|
||
The above commands do a user level install of the "pip script installer", | ||
and then install `pew` and `pipenv` into isolated virtual environments | ||
for reliability of later updates. (`pew` needs to be installed separately | ||
so `pipenv` sees only the command line interface instead of the Python API) | ||
|
||
Once `pipenv` is installed, run the following to install the | ||
integration testing environment: | ||
|
||
$ pipenv --three && pipenv install | ||
|
||
Note that while `leapp` itself will run under Python 2.7, the integration | ||
tests require Python 3. | ||
|
||
## Running the tests | ||
|
||
To get a local shell with the testing environment active, run: | ||
|
||
$ pipenv shell | ||
|
||
Once in the testing environment, the tests can be run by invoking | ||
`behave` test runner directly: | ||
|
||
$ behave | ||
|
||
The tests require passwordless `sudo` access to both `vagrant` | ||
and `leapp-tool` (alternatively, they will require interactive | ||
password entry during the test). | ||
|
||
## Writing new tests | ||
|
||
New feature definitions go in the ["features"](./features) subdirectory. | ||
|
||
New step definitions go in the ["features/steps"](./features.steps) | ||
subdirectory, and use the | ||
["hamcrest"](https://pyhamcrest.readthedocs.io/en/latest/tutorial/) | ||
library to define behavioural expectations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import contextlib | ||
|
||
def before_scenario(context, scenario): | ||
context.resource_manager = contextlib.ExitStack() | ||
|
||
def after_scenario(context, scenario): | ||
context.resource_manager.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: Redeploy stateless HTTP services | ||
|
||
Scenario: HTTP default server page | ||
Given the local virtual machines: | ||
| name | definition | ensure_fresh | | ||
| app-source | centos6-guest-httpd | no | | ||
| target | centos7-target | no | | ||
When app-source is redeployed to target as a macrocontainer | ||
Then the HTTP responses on port 80 should match within 90 seconds |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to
cd integration-tests/
before callingbehave
.