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

Demo ansible-test with zuul #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- project:
check:
jobs:
- ansible-test-network-integration-eos-python35
- ansible-test-sanity
Empty file removed abc.txt
Empty file.
7 changes: 6 additions & 1 deletion bindep.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.

gcc-c++ [doc platform:rpm]
gcc-c++ [test platform:rpm]
python2.7-dev [test platform:dpkg]
python3-devel [test !platform:centos-7 platform:rpm]
python3-dev [test platform:dpkg]
python3-libselinux [test !platform:centos-7 platform:rpm]
python3 [test !platform:centos-7 platform:rpm]
70 changes: 0 additions & 70 deletions doc/source/conf.py

This file was deleted.

14 changes: 0 additions & 14 deletions doc/source/index.rst

This file was deleted.

6 changes: 0 additions & 6 deletions doc/source/releasenotes.rst

This file was deleted.

57 changes: 57 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
### REQUIRED

# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: ansible_network

# The name of the collection. Has the same character restrictions as 'namespace'
name: sandbox

# The version of the collection. Must be compatible with semantic versioning
version: 0.0.1

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.rst

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- your name <[email protected]>


### OPTIONAL but strongly recommended

# A short summary description of the collection
description: your description

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: ''

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: []

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: http://example.com/repository

# The URL to any online docs
documentation: http://docs.example.com

# The URL to the homepage of the collection/project
homepage: http://example.com

# The URL to the collection issue tracker
issues: http://example.com/issue/tracker
32 changes: 0 additions & 32 deletions meta/main.yml

This file was deleted.

21 changes: 21 additions & 0 deletions plugins/action/foobar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2018 Red Hat Inc.
#
# 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/>.
#

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
4 changes: 0 additions & 4 deletions releasenotes/notes/hello-fd8a3c148ac33cd7.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions releasenotes/notes/next-step-16a661e3707da22b.yaml

This file was deleted.

Empty file removed tasks/main.yaml
Empty file.
3 changes: 0 additions & 3 deletions test.txt

This file was deleted.

3 changes: 3 additions & 0 deletions test/integration/integration_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
win_output_dir: 'C:\ansible_testing'
output_dir: ~/ansible_testing
32 changes: 32 additions & 0 deletions test/integration/target-prefixes.network
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
a10
aci
aireos
aruba
asa
bigip
ce
cl
cnos
dellos10
dellos6
dellos9
edgeos
enos
eos
exos
ios
iosxr
ironware
junos
meraki
mso
net
netconf
nxos
onyx
openvswitch
ops
pn
slxos
sros
vyos
3 changes: 3 additions & 0 deletions test/integration/targets/eos_banner/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
testcase: "*"
test_items: []
2 changes: 2 additions & 0 deletions test/integration/targets/eos_banner/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dependencies:
- prepare_eos_tests
16 changes: 16 additions & 0 deletions test/integration/targets/eos_banner/tasks/cli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: collect all cli test cases
find:
paths: "{{ role_path }}/tests/cli"
patterns: "{{ testcase }}.yaml"
register: test_cases
delegate_to: localhost

- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"

- name: run test cases (connection=network_cli)
include: "{{ test_case_to_run }} ansible_connection=network_cli"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
16 changes: 16 additions & 0 deletions test/integration/targets/eos_banner/tasks/eapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: collect all eapi test cases
find:
paths: "{{ role_path }}/tests/eapi"
patterns: "{{ testcase }}.yaml"
delegate_to: localhost
register: test_cases

- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"

- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
3 changes: 3 additions & 0 deletions test/integration/targets/eos_banner/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: eapi.yaml, tags: ['eapi'] }
66 changes: 66 additions & 0 deletions test/integration/targets/eos_banner/tests/cli/basic-login.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
- debug: msg="START cli/basic-login.yaml on connection={{ ansible_connection }}"

- name: Remove previous login banner
eos_config:
lines: no banner login
become: yes

- name: Create login banner
eos_banner: &multiline
banner: login
text: |
Junk login banner
over multiple lines
state: present
become: yes
register: result

- assert:
that:
- "result.changed == true"
- "'banner login' in result.commands[0]" # does this break due to "contains?"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"

- name: Create login banner again (idempotent)
eos_banner: *multiline
become: yes
register: result

- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"

- name: Remove login
eos_banner: &remove
banner: login
state: absent
become: yes
register: result

- assert:
that:
- "result.changed == true"
- "'no banner login' in result.commands" # does this break due to "contains?"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"

- name: Remove login again (idempotent)
eos_banner: *remove
become: yes
register: result

- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"

# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"
Loading