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

Fix flaky test_namespace_create_and_delete[v3] #2010

Merged

Conversation

jerabekjiri
Copy link
Contributor

@jerabekjiri jerabekjiri commented Dec 12, 2023

No-Issue

https://github.com/ansible/galaxy_ng/actions/runs/7171839578/job/19529139780?pr=2003#step:8:1344

=================================== FAILURES ===================================
_____________________ test_namespace_create_and_delete[v3] _____________________

api_version = 'v3'
galaxy_client = <bound method GalaxyKitClient.gen_authorized_client of <galaxy_ng.tests.integration.utils.iqe_utils.GalaxyKitClient object at 0x7fe17effc490>>

    @pytest.mark.galaxyapi_smoke
    @pytest.mark.namespace
    @pytest.mark.parametrize(
        "api_version",
        [
            'v3',
            '_ui/v1'
        ]
    )
    @pytest.mark.all
    def test_namespace_create_and_delete(api_version, galaxy_client):
        """Tests whether a namespace can be created and deleted"""
    
        # http://192.168.1.119:8002/api/automation-hub/_ui/v1/namespaces/
        # http://192.168.1.119:8002/api/automation-hub/v3/namespaces/
        # {name: "testnamespace1", groups: []}
        gc = galaxy_client("partner_engineer")
        new_namespace = f"ns_test_{generate_random_string()}"
        payload = {'name': new_namespace, 'groups': []}
        resp = gc.post(f"{api_version}/namespaces/", body=payload)
        assert resp['name'] == new_namespace
        if api_version == "v3":
            get_namespace(gc, new_namespace)
            gc.delete(f"{api_version}/namespaces/{new_namespace}/", parse_json=False)
>           with pytest.raises(KeyError):
E           Failed: DID NOT RAISE <class 'KeyError'>

galaxy_ng/tests/integration/api/test_namespace_management.py:46: Failed

Fix by waiting for namespace metadata tasks to finish.

@jerabekjiri jerabekjiri merged commit e607f1d into ansible:master Dec 12, 2023
21 of 22 checks passed
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

Successfully merging this pull request may close these issues.

2 participants