Skip to content
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

docker_network: add basic integration tests #46137

Merged
merged 2 commits into from
Oct 19, 2018

Conversation

felixfontein
Copy link
Contributor

SUMMARY

So far, there are no tests for docker_network at all. Having some would definitely be nice for #43997.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

docker_network

ANSIBLE VERSION
2.8.0

@ansibot
Copy link
Contributor

ansibot commented Sep 25, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud docker needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Sep 25, 2018
@felixfontein
Copy link
Contributor Author

CC @kassiansun @pilou- since you might have some general interest in this, too

msg: "Using name prefix {{ name_prefix }}"

- block:
- include_tasks: run-test.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use - include_tasks: "{{ item }}" directly, no need to use run-test.yml (- include_tasks: tests/basic.yml works too)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one big advantage over doing it this way: if you do all include_tasks directly, you will get the included: .../tasks/tests/xxx.yml for localhost all at the same time, while with this indirect include, you will get them before the tasks are actually executed. This makes it easier to find out in which file a task is defined (if you're hunting down something that breaks).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I originally did it directly for the docker_container tests, but after I had two tests instead of only one, I noticed this and changed it this way to make it easier to find out to which "sub-test" tests belong to.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to change here, I would have done differently (maybe using debug module :)

name: "{{ item }}"
state: absent
stop_timeout: 1
with_items: "{{ cnames }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to use loop here (it is already used in basic.yml).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

nname_2: "{{ name_prefix ~ '-network-2' }}"
- name: Registering container name
set_fact:
cnames: "{{ cnames }} + [cname_1, cname_2, cname_3]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't cnames: "[cname_1, cname_2, cname_3]" sufficient ? Then set_fact: cnames at beginning of main.yml could be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now there's only one sub-test (basic.yml), so yes, that would work, but as soon as one more is added, this is necessary (so that all names are collected, and the objects will be destroyed even in case of failing tests and other errors).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this future test will look like :)

name: "{{ container_name }}"
image: hello-world
state: present
loop:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loop: {{ cnames }} could be used here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only at this point where there's only one sub-test.

- "{{ cname_3 }}"
loop_control:
loop_var: container_name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idempotency check for container ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's already done enough many times in the docker_container integration tests ;)

@@ -0,0 +1,117 @@
---
- name: Registering container name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and network"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Sep 26, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 4, 2018
Copy link
Contributor

@pilou- pilou- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Oct 6, 2018

Components

test/integration/targets/docker_network/aliases
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/meta/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/run-test.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/tests/basic.yml
support: community
maintainers: chouseknecht keitwb olsaki

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: pilou-
automerge: automerge shipit test failed

click here for bot help

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 6, 2018
@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Oct 6, 2018

Components

test/integration/targets/docker_network/aliases
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/meta/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/run-test.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/tests/basic.yml
support: community
maintainers: chouseknecht keitwb olsaki

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: []
automerge: automerge shipit test failed

click here for bot help

@pilou-
Copy link
Contributor

pilou- commented Oct 7, 2018

LGTM

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 15, 2018
@felixfontein
Copy link
Contributor Author

Getting rid of stale_ci.

@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Oct 16, 2018

Components

test/integration/targets/docker_network/aliases
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/meta/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/run-test.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/tests/basic.yml
support: community
maintainers: chouseknecht keitwb olsaki

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: pilou-
automerge: automerge shipit test failed

click here for bot help

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 16, 2018
@felixfontein
Copy link
Contributor Author

@dariko @jwitko @kassiansun @tbouvet Can anyone of you take a look here?

@kassiansun
Copy link
Contributor

shipit

@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Oct 18, 2018

Components

test/integration/targets/docker_network/aliases
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/meta/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/run-test.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/tests/basic.yml
support: community
maintainers: chouseknecht keitwb olsaki

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: pilou- kassiansun
automerge: automerge shipit test failed

click here for bot help

@felixfontein
Copy link
Contributor Author

Hmmm, shouldn't kassiansun count as a namespace maintainer?

@felixfontein
Copy link
Contributor Author

Something similar to this PR is included in #35370.

@ansibot ansibot added the community_review In order to be merged, this PR must follow the community review workflow. label Oct 18, 2018
@felixfontein
Copy link
Contributor Author

bot_status

@ansibot
Copy link
Contributor

ansibot commented Oct 18, 2018

Components

test/integration/targets/docker_network/aliases
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/meta/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/main.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/run-test.yml
support: community
maintainers: chouseknecht keitwb olsaki

test/integration/targets/docker_network/tasks/tests/basic.yml
support: community
maintainers: chouseknecht keitwb olsaki

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 1
shipit_actors (maintainers or core team members): felixfontein
shipit_actors_other: pilou- kassiansun
automerge: automerge shipit test failed

click here for bot help

@gundalow gundalow merged commit 131efcf into ansible:devel Oct 19, 2018
@gundalow
Copy link
Contributor

Yay for tests, thank you. Maybe worth backporting this to stable-2.7

@felixfontein felixfontein deleted the docker_network-tests branch October 19, 2018 07:58
@felixfontein
Copy link
Contributor Author

Thanks everyone for reviewing and getting this merged!

felixfontein added a commit to felixfontein/ansible that referenced this pull request Oct 20, 2018
* Adding very basic integration tests for docker_network.

* Fixing some details (review comments).

(cherry picked from commit 131efcf)
abadger pushed a commit that referenced this pull request Oct 22, 2018
* Adding very basic integration tests for docker_network.

* Fixing some details (review comments).

(cherry picked from commit 131efcf)
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
* Adding very basic integration tests for docker_network.

* Fixing some details (review comments).
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. docker support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants