Sanity test fixups: AWS VPC related modules (#64089)

* Add missing boilerplate

* Avoid blocklisted variable name '_'

* doc fixups

* Remove defaults for required parameters

* Remove explicit definition of 'region' from argument spec
it's automatically added by ec2_argument_spec and redefining removes the aliases

* remove sanity ignore entries for AWS VPC related modules

* Suggested Review changes
This commit is contained in:
Mark Chappell
2019-10-30 22:28:14 +01:00
committed by Jill R
parent 56db433d63
commit 4e8bb334a9
24 changed files with 195 additions and 147 deletions

View File

@ -1,3 +1,8 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
import unittest
@ -85,7 +90,7 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
def test_get_eip_allocation_id_by_address(self):
client = boto3.client('ec2', region_name=aws_region)
allocation_id, _ = (
allocation_id, error_msg = (
ng.get_eip_allocation_id_by_address(
client, '55.55.55.55', check_mode=True
)
@ -114,7 +119,7 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
def test_release_address(self):
client = boto3.client('ec2', region_name=aws_region)
success, _ = (
success, err_msg = (
ng.release_address(
client, 'eipalloc-1234567', check_mode=True
)
@ -173,7 +178,7 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
def test_delete(self):
client = boto3.client('ec2', region_name=aws_region)
success, changed, err_msg, _ = (
success, changed, err_msg, results = (
ng.remove(
client, 'nat-123456789', check_mode=True
)
@ -183,7 +188,7 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
def test_delete_and_release_ip(self):
client = boto3.client('ec2', region_name=aws_region)
success, changed, err_msg, _ = (
success, changed, err_msg, results = (
ng.remove(
client, 'nat-123456789', release_eip=True, check_mode=True
)
@ -193,7 +198,7 @@ class AnsibleEc2VpcNatGatewayFunctions(unittest.TestCase):
def test_delete_if_does_not_exist(self):
client = boto3.client('ec2', region_name=aws_region)
success, changed, err_msg, _ = (
success, changed, err_msg, results = (
ng.remove(
client, 'nat-12345', check_mode=True
)

View File

@ -1,19 +1,8 @@
# (c) 2017 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/>.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
import os
@ -165,8 +154,8 @@ def test_find_connection_insufficient_filters(placeboify, maybe_sleep):
params2 = make_params(cgw[1], vgw[1], tags={'Correct': 'Tag'})
m, conn = setup_mod_conn(placeboify, params)
m2, conn2 = setup_mod_conn(placeboify, params2)
_, vpn1 = ec2_vpc_vpn.ensure_present(conn, m.params)
_, vpn2 = ec2_vpc_vpn.ensure_present(conn2, m2.params)
vpn1 = ec2_vpc_vpn.ensure_present(conn, m.params)[1]
vpn2 = ec2_vpc_vpn.ensure_present(conn2, m2.params)[1]
# reset the parameters so only filtering by tags will occur
m.params = {'filters': {'tags': {'Correct': 'Tag'}}}
@ -354,7 +343,7 @@ def setup_req(placeboify, number_of_results=1):
for each in range(0, number_of_results):
params = make_params(cgw[each], vgw[each])
m, conn = setup_mod_conn(placeboify, params)
_, vpn = ec2_vpc_vpn.ensure_present(conn, params)
vpn = ec2_vpc_vpn.ensure_present(conn, params)[1]
results.append({'module': m, 'connection': conn, 'vpn': vpn, 'params': params})
if number_of_results == 1: