-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
apt: allow for integration tests using fake repo #37639
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.
Jump to
Jump to file
Failed to load files.
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,2 +1,3 @@ | ||
dependencies: | ||
- prepare_tests | ||
- setup_deb_repo |
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
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,42 @@ | ||
- block: | ||
- name: Install foo package version 1.0.0 | ||
apt: | ||
name: foo=1.0.0 | ||
allow_unauthenticated: yes | ||
register: apt_result | ||
|
||
- name: Check install with dpkg | ||
shell: dpkg-query -l foo | ||
register: dpkg_result | ||
|
||
- name: Check if install was successful | ||
assert: | ||
that: | ||
- "apt_result is success" | ||
- "dpkg_result is success" | ||
- "'1.0.0' in dpkg_result.stdout" | ||
|
||
- name: Update to foo version 1.0.1 | ||
apt: | ||
name: foo | ||
state: latest | ||
allow_unauthenticated: yes | ||
register: apt_result | ||
|
||
- name: Check install with dpkg | ||
shell: dpkg-query -l foo | ||
register: dpkg_result | ||
|
||
- name: Check if install was successful | ||
assert: | ||
that: | ||
- "apt_result is success" | ||
- "dpkg_result is success" | ||
- "'1.0.1' in dpkg_result.stdout" | ||
|
||
always: | ||
- name: Clean up | ||
apt: | ||
name: foo | ||
state: absent | ||
allow_unauthenticated: yes |
10 changes: 10 additions & 0 deletions
10
test/integration/targets/setup_deb_repo/files/package_specs/foo-1.0.0
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,10 @@ | ||
Section: misc | ||
Priority: optional | ||
Standards-Version: 2.3.3 | ||
|
||
Package: foo | ||
Version: 1.0.0 | ||
Section: system | ||
Maintainer: John Doe <john@doe.com> | ||
Architecture: all | ||
Description: Dummy package |
10 changes: 10 additions & 0 deletions
10
test/integration/targets/setup_deb_repo/files/package_specs/foo-1.0.1
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,10 @@ | ||
Section: misc | ||
Priority: optional | ||
Standards-Version: 2.3.3 | ||
|
||
Package: foo | ||
Version: 1.0.1 | ||
Section: system | ||
Maintainer: John Doe <john@doe.com> | ||
Architecture: all | ||
Description: Dummy package |
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,36 @@ | ||
- block: | ||
- name: Install needed packages | ||
apt: | ||
name: "{{ item }}" | ||
with_items: | ||
- dpkg-dev | ||
- equivs | ||
- libfile-fcntllock-perl # to silence warning by equivs-build | ||
|
||
- set_fact: | ||
repodir: /tmp/repo/ | ||
|
||
- name: Create repo dir | ||
file: | ||
path: "{{ repodir }}" | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: Create deb files | ||
shell: "equivs-build {{ item }}" | ||
args: | ||
chdir: "{{ repodir }}" | ||
with_fileglob: | ||
- "files/package_specs/*" | ||
|
||
- name: Create repo | ||
shell: dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz | ||
args: | ||
chdir: "{{ repodir }}" | ||
|
||
- name: Install the repo | ||
apt_repository: | ||
repo: "deb file:{{ repodir }} ./" | ||
validate_certs: no | ||
|
||
when: ansible_distribution in ['Ubuntu', 'Debian'] |
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.
This repo should be removed when the test ends (success or failure) along with the installed package(s).
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.
Thanks for the review, should be fixed. Also did that in the yum tests - #37770.