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

Coordination with other fixtures #33

Open
stenzing opened this issue Sep 9, 2020 · 0 comments
Open

Coordination with other fixtures #33

stenzing opened this issue Sep 9, 2020 · 0 comments

Comments

@stenzing
Copy link

stenzing commented Sep 9, 2020

Hi!

We started to experience some issues in out tests, related to 500 exceptions from mocks that should be coming from this package.
We had in start issues with all container related items, not just these, but there, providing an ordering via depending fixtures on eachother solved the issues. But compared to the others, as there is no fixture annotation we can refer to for this package, we cannot depend on completion either. As far as we can observe the
following constellation we cannot create the sqs queue currently, which is a cnahge in the pytest behavior from a couple of moths before, when this was not an issue yet:


stack = pytest_localstack.patch_fixture(
    services=["s3", "sqs"],  # Limit to the AWS services you need.
    scope='module',  # Use the same Localstack container for all tests in this module.
    autouse=True,  # Automatically use this fixture in tests.
)


@pytest.fixture()
def mocked_configuration(init_localstack) -> Configuration:
    config = Configuration(get_basic_logger())
    config.load_dict_config({
        'SQSQueues': {
            'PendingDeletionWorkload': 'testQueue1'}
    })
    return config


@pytest.fixture()
def prepare_test_queue(mocked_configuration) -> Any:
    sqs = boto3.client("sqs")
    sqs.create_queue(QueueName=mocked_configuration.get_config_value("SQSQueues/PendingDeletionWorkload"))
    return sqs

Now we get the exception:

self = <botocore.parsers.QueryParser object at 0x7f6d4eb6df90>
xml_string = b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Serv...nd was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>\n'

    def _parse_xml_string_to_dom(self, xml_string):
        try:
            parser = ETree.XMLParser(
                target=ETree.TreeBuilder(),
                encoding=self.DEFAULT_ENCODING)
            parser.feed(xml_string)
            root = parser.close()
        except XMLParseError as e:
            raise ResponseParserError(
                "Unable to parse response (%s), "
                "invalid XML received. Further retries may succeed:\n%s" %
>               (e, xml_string))
E           botocore.parsers.ResponseParserError: Unable to parse response (syntax error: line 1, column 54), invalid XML received. Further retries may succeed:
E           b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>500 Internal Server Error</title>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>\n'

../../../../.pyenv/versions/aws-gateway-delete/lib/python3.7/site-packages/botocore/parsers.py:457: ResponseParserError

I would like to know how we could make the other fixtures that are seting up the queues depend on the completion of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant