-
Notifications
You must be signed in to change notification settings - Fork 2
Add integration testing #33
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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,39 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Run a Pulp in one container, and reset the admin password to 'password'. | ||
| # Use only for testing! | ||
|
|
||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| mkdir -p settings | ||
|
|
||
| cat << EOF > settings/settings.py | ||
| CONTENT_ORIGIN='http://$(hostname):8080' | ||
| ANSIBLE_API_HOSTNAME='http://$(hostname):8080' | ||
| ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content' | ||
| TOKEN_AUTH_DISABLED=True | ||
| EOF | ||
|
|
||
| # Run Pulp in one container. | ||
| docker run \ | ||
| --detach \ | ||
| --name pulp \ | ||
| --volume "$(pwd)/settings":/etc/pulp \ | ||
| --publish 8080:80 \ | ||
| pulp/pulp:latest | ||
|
|
||
| # Wait for it to come up. | ||
| attempts=0 | ||
| until curl --fail http://localhost:8080/pulp/api/v3/status/ > /dev/null 2>&1; do | ||
| sleep 2 | ||
| attempts=$((attempts + 1)) | ||
| if [[ $attempts -ge 60 ]]; then | ||
| echo "Timed out waiting for pulp" | ||
| docker logs pulp | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| # Reset the admin password. | ||
| docker exec pulp pulpcore-manager reset-admin-password --password password | ||
This file contains hidden or 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 @@ | ||
| ../roles |
This file contains hidden or 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,185 @@ | ||
| --- | ||
| - name: Test pulp_distribution | ||
| gather_facts: false | ||
| hosts: localhost | ||
| vars: | ||
| pulp_url: http://localhost:8080 | ||
| pulp_username: admin | ||
| pulp_password: password | ||
| pulp_validate_certs: true | ||
| tasks: | ||
| - include_role: | ||
| name: pulp_repository | ||
| vars: | ||
| pulp_repository_deb_repos: | ||
| - name: test_deb_repo | ||
| url: "https://fixtures.pulpproject.org/debian/" | ||
| distributions: "ragnarok" | ||
| policy: immediate | ||
| state: present | ||
|
|
||
| - include_role: | ||
| name: pulp_publication | ||
| vars: | ||
| pulp_publication_deb: | ||
| - repository: test_deb_repo | ||
| state: present | ||
|
|
||
| - include_role: | ||
| name: pulp_distribution | ||
| vars: | ||
| pulp_distribution_deb: | ||
| - name: test_deb_distribution | ||
| base_path: test_deb_distribution | ||
| repository: test_deb_repo | ||
| state: present | ||
| - name: test_deb_distribution_version_1 | ||
| base_path: test_deb_distribution_version_1 | ||
| repository: test_deb_repo | ||
| version: 1 | ||
| state: present | ||
|
|
||
| # FIXME: This currently fails due to | ||
| # https://github.com/stackhpc/ansible-collection-pulp/issues/34. | ||
| # - include_role: | ||
| # name: pulp_distribution | ||
| # vars: | ||
| # pulp_distribution_deb: | ||
| # - name: test_deb_distribution_distribution | ||
| # base_path: test_deb_distribution_distribution | ||
| # distribution: test_deb_distribution | ||
| # state: present | ||
|
|
||
| - name: Query repository | ||
| pulp.squeezer.deb_repository: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| name: test_deb_repo | ||
| register: repo_result | ||
|
|
||
| - name: Query publication | ||
| pulp.squeezer.deb_publication: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| repository: test_deb_repo | ||
| version: 1 | ||
| register: pub_result | ||
|
|
||
| - name: Query distribution | ||
| pulp.squeezer.deb_distribution: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| name: test_deb_distribution | ||
| register: dist_result | ||
|
|
||
| - name: Query distribution version 1 | ||
| pulp.squeezer.deb_distribution: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| name: test_deb_distribution_version_1 | ||
| register: dist_version_1_result | ||
|
|
||
| # FIXME: This currently fails due to | ||
| # https://github.com/stackhpc/ansible-collection-pulp/issues/34. | ||
| # - name: Query distribution distribution | ||
| # pulp.squeezer.deb_distribution: | ||
| # pulp_url: "{{ pulp_url }}" | ||
| # username: "{{ pulp_username }}" | ||
| # password: "{{ pulp_password }}" | ||
| # validate_certs: "{{ pulp_validate_certs }}" | ||
| # name: test_deb_distribution_distribution | ||
| # register: dist_distribution_result | ||
|
|
||
| - name: Verify publication creation | ||
| assert: | ||
| that: | ||
| - pub_result.publication.repository == repo_result.repository.pulp_href | ||
|
|
||
| - name: Verify distribution creation | ||
| assert: | ||
| that: | ||
| - dist_result.distribution.name == "test_deb_distribution" | ||
| - dist_result.distribution.base_path == "test_deb_distribution" | ||
| - dist_result.distribution.publication == pub_result.publication.pulp_href | ||
|
|
||
| - name: Verify distribution creation | ||
| assert: | ||
| that: | ||
| - dist_version_1_result.distribution.name == "test_deb_distribution_version_1" | ||
| - dist_version_1_result.distribution.base_path == "test_deb_distribution_version_1" | ||
| - dist_version_1_result.distribution.publication == pub_result.publication.pulp_href | ||
|
|
||
| # FIXME: This currently fails due to | ||
| # https://github.com/stackhpc/ansible-collection-pulp/issues/34. | ||
| # - name: Verify distribution creation | ||
| # assert: | ||
| # that: | ||
| # - dist_distribution_result.distribution.name == "test_deb_distribution_distribution" | ||
| # - dist_distribution_result.distribution.base_path == "test_deb_distribution_distribution" | ||
| # - dist_distribution_result.distribution.publication == pub_result.publication.pulp_href | ||
|
|
||
| - include_role: | ||
| name: pulp_distribution | ||
| vars: | ||
| pulp_distribution_deb: | ||
| - name: test_deb_distribution | ||
| # FIXME: These should not be required. | ||
| repository: test_deb_repo | ||
| base_path: foo | ||
| state: absent | ||
| - name: test_deb_distribution_version_1 | ||
| # FIXME: These should not be required. | ||
| repository: test_deb_repo | ||
| base_path: foo | ||
| state: absent | ||
| - name: test_deb_distribution_distribution | ||
| # FIXME: These should not be required. | ||
| repository: test_deb_repo | ||
| base_path: foo | ||
| state: absent | ||
|
|
||
| - include_role: | ||
| name: pulp_publication | ||
| vars: | ||
| pulp_publication_deb: | ||
| - repository: test_deb_repo | ||
| state: absent | ||
|
|
||
| - include_role: | ||
| name: pulp_repository | ||
| vars: | ||
| pulp_repository_deb_repos: | ||
| - name: test_deb_repo | ||
| state: absent | ||
|
|
||
| - name: Query distributions | ||
| pulp.squeezer.deb_distribution: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| register: deb_distributions | ||
|
|
||
| - name: Verify distribution deletion | ||
| assert: | ||
| that: deb_distributions.distributions | length == 0 | ||
|
|
||
| - name: Query publications | ||
| pulp.squeezer.deb_publication: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| register: deb_publications | ||
|
|
||
| - name: Verify publication deletion | ||
| assert: | ||
| that: deb_publications.publications | length == 0 |
This file contains hidden or 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,81 @@ | ||
| --- | ||
| - name: Test pulp_repository | ||
| gather_facts: false | ||
| hosts: localhost | ||
| vars: | ||
| pulp_url: http://localhost:8080 | ||
| pulp_username: admin | ||
| pulp_password: password | ||
| pulp_validate_certs: true | ||
| tasks: | ||
| - include_role: | ||
| name: pulp_repository | ||
| vars: | ||
| pulp_repository_deb_repos: | ||
| - name: test_deb_repo | ||
| url: "https://fixtures.pulpproject.org/debian/" | ||
| distributions: "ragnarok" | ||
| policy: immediate | ||
| state: present | ||
|
|
||
| - name: Query repository | ||
| pulp.squeezer.deb_repository: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| name: test_deb_repo | ||
| register: repo_result | ||
|
|
||
| - name: Verify repository creation | ||
| assert: | ||
| that: | ||
| - repo_result.repository.name == "test_deb_repo" | ||
|
|
||
| - name: Query remote | ||
| pulp.squeezer.deb_remote: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| name: test_deb_repo-remote | ||
| register: remote_result | ||
|
|
||
| - name: Verify remote creation | ||
| assert: | ||
| that: | ||
| - remote_result.remote.name == "test_deb_repo-remote" | ||
| - remote_result.remote.url == "https://fixtures.pulpproject.org/debian/" | ||
| - remote_result.remote.distributions == "ragnarok" | ||
| - remote_result.remote.policy == "immediate" | ||
|
|
||
| - include_role: | ||
| name: pulp_repository | ||
| vars: | ||
| pulp_repository_deb_repos: | ||
| - name: test_deb_repo | ||
| state: absent | ||
|
|
||
| - name: Query repositories | ||
| pulp.squeezer.deb_repository: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| register: deb_repositories | ||
|
|
||
| - name: Verify repository deletion | ||
| assert: | ||
| that: deb_repositories.repositories | length == 0 | ||
|
|
||
| - name: Query remotes | ||
| pulp.squeezer.deb_remote: | ||
| pulp_url: "{{ pulp_url }}" | ||
| username: "{{ pulp_username }}" | ||
| password: "{{ pulp_password }}" | ||
| validate_certs: "{{ pulp_validate_certs }}" | ||
| register: deb_remotes | ||
|
|
||
| - name: Verify remote deletion | ||
| assert: | ||
| that: deb_remotes.remotes | length == 0 |
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.
latest is good for starters, let's see how often will it fail ;-)