mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Cleanup aws unit test hang
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
93ab61e46d
commit
281bf59f3c
2 changed files with 20 additions and 32 deletions
|
@ -7,7 +7,7 @@ This is a base library used by a number of AWS services.
|
|||
|
||||
:depends: requests
|
||||
"""
|
||||
|
||||
import binascii
|
||||
import copy
|
||||
import hashlib
|
||||
import hmac
|
||||
|
@ -15,43 +15,18 @@ import logging
|
|||
import random
|
||||
import re
|
||||
import time
|
||||
import urllib.parse
|
||||
import xml.etree.ElementTree as ET
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
import salt.config
|
||||
import salt.utils.hashutils
|
||||
import salt.utils.xmlutil as xml
|
||||
|
||||
try:
|
||||
import requests
|
||||
|
||||
HAS_REQUESTS = True # pylint: disable=W0612
|
||||
except ImportError:
|
||||
HAS_REQUESTS = False # pylint: disable=W0612
|
||||
|
||||
try:
|
||||
import binascii
|
||||
|
||||
HAS_BINASCII = True # pylint: disable=W0612
|
||||
except ImportError:
|
||||
HAS_BINASCII = False # pylint: disable=W0612
|
||||
|
||||
try:
|
||||
import urllib.parse
|
||||
|
||||
HAS_URLLIB = True # pylint: disable=W0612
|
||||
except ImportError:
|
||||
HAS_URLLIB = False # pylint: disable=W0612
|
||||
|
||||
try:
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
HAS_ETREE = True # pylint: disable=W0612
|
||||
except ImportError:
|
||||
HAS_ETREE = False # pylint: disable=W0612
|
||||
|
||||
# pylint: enable=import-error,redefined-builtin,no-name-in-module
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_LOCATION = "us-east-1"
|
||||
DEFAULT_AWS_API_VERSION = "2016-11-15"
|
||||
AWS_RETRY_CODES = [
|
||||
|
|
|
@ -4,17 +4,30 @@
|
|||
|
||||
Test the salt aws functions
|
||||
"""
|
||||
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
import salt.utils.aws as aws
|
||||
from tests.support.helpers import patched_environ
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _cleanup():
|
||||
# Make sure this cache is clear before each test
|
||||
aws.__AssumeCache__.clear()
|
||||
# Remove any AWS_ prefixed environment variables
|
||||
with patched_environ(
|
||||
__cleanup__=[k for k in os.environ if k.startswith("AWS_")],
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
def test_get_metadata_imdsv1():
|
||||
response = requests.Response()
|
||||
response.status_code = 200
|
||||
|
|
Loading…
Add table
Reference in a new issue