Skip to content

Commit

Permalink
feat(test): CCT-663 - Adding betelgeuse docstrings to test_connection.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zpetrace committed Sep 18, 2024
1 parent b166cbf commit 5693a82
Showing 1 changed file with 88 additions and 8 deletions.
96 changes: 88 additions & 8 deletions integration-tests/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""
:casecomponent: insights-client
:requirement: RHSS-291297
:subsystemteam: sst_csi_client_tools
:caseautomation: Automated
:upstream: Yes
"""

import pytest

# the tests need a valid connection to insights so therefore the subman registration
Expand All @@ -6,8 +14,20 @@

def test_connection(insights_client):
"""
Test insights-client --test-connection
`test_connection` method returns 0 if success, 1 if failure
:id: ff674d37-0ccc-481c-9f04-91237b8c50d0
:title: Test connection
:description:
This test verifies that the --test-connection option works
properly, confirming successfull connection
:tier: Tier 1
:steps:
1. Run insights-client with --test-connection option
2. Verify that the connection to the upload URl is successful
3. Verify that the connection to the API URL is successful
:expectedresults:
1. The command executes successfully
2. The output contains the expected output about upload connection
3. The output contains expected message about API URL connection
"""
url_test = "End Upload URL Connection Test: SUCCESS"
api_test = "End API URL Connection Test: SUCCESS"
Expand All @@ -19,9 +39,22 @@ def test_connection(insights_client):

def test_http_timeout(insights_client):
"""
Test http_timeout config option
Set http_timeout to a very low value, run --test-connection and check
the set time
:id: 46c5fe2a-1553-4f2e-802d-fa10080c72df
:title: Test HTTP timeout configuration
:description:
Verifies that setting a very low http_timeout value causes
the connection to time out
:tier: Tier 1
:steps:
1. Set the http_timeout option to a very low value and save
2. Run insights-client with the --test-conection option
3. Verify that the command fails due to the low timeout setting
4. Check that the timeout value is in the output
:expectedresults:
1. The http_timeout configuration is set and saved
2. The insights-client command is run
3. The command fails with a return code of 1
4. The output mentions timeout value
"""
insights_client.config.http_timeout = 0.01
insights_client.config.save()
Expand All @@ -33,7 +66,22 @@ def test_http_timeout(insights_client):

def test_noauth_proxy_connection(insights_client, test_config):
"""
Test no-auth proxy option with --test-connection option
:id: a4bcb7e6-c04f-49d2-8362-525124dc61d9
:title: Test no-auth proxy connection
:description:
Verifies that the insights-client can successfully connect
through a no-auth proxy when using the --test-connection option
:tier: Tier 1
:steps:
1. Configure insights-client to use no-auth proxy and save
2. Run insights-client with the --test-connection option
3. Verify the connection to the upload URL is successful
4. Verify that the connection to the API URL is successful
:expectedresults:
1. Insights-client is configured to use no-auth proxy
2. The command is executed successfully
3. The output mentions that the upload URL connection was suuccessful
4. The output mentions that the API URL connection test was successful
"""
url_test = "End Upload URL Connection Test: SUCCESS"
api_test = "End API URL Connection Test: SUCCESS"
Expand All @@ -54,7 +102,22 @@ def test_noauth_proxy_connection(insights_client, test_config):

def test_auth_proxy_connection(insights_client, test_config):
"""
Test auth proxy option with --test-connection
:id: 0b3e91d6-3b8b-42c7-8f3b-f7ee1728c311
:title: Test auth-proxy connection
:description:
Verifies that the insights-client can successfully connect
through an authenticated proxy
:tier: Tier 1
:steps:
1. Configure insights-client to use auth proxy and save
2. Run the insights-client with --test-connection option
3. Verify the connection to the upload URL is successful
4. Verify that the connection to the API URL is successful
:expectedresults:
1. Insights-client is configured to use auth proxy
2. The command is executed successfully
3. The output mentions that the upload URL connection was suuccessful
4. The output mentions that the API URL connection test was successful
"""
url_test = "End Upload URL Connection Test: SUCCESS"
api_test = "End API URL Connection Test: SUCCESS"
Expand All @@ -78,7 +141,24 @@ def test_auth_proxy_connection(insights_client, test_config):

def test_wrong_url_connection(insights_client):
"""
Test wrong url option with --test-connection
:id: aa411b34-9af2-4759-ae05-756e9019c85e
:title: Test wrong URL connection
:description:
Verifies that the insights-client fails to connect when an
incorrect URL is configured
:tier: Tier 1
:steps:
1. Disable auto-configuration and auto-updates
2. Set an incorrect base URL in the configuration
3. Run insights-client with the --test-connection option
4. Verify the command fails due to the incorrect URL
5. Check that the output contains the appropriate failure message
:expectedresults:
1. Auto-configuration and auto-updates are disabled
2. Incorrect base URL is set
3. Insights-client command is executed successfully
4. The command failed with a return code of 1
5. The message includes expected mentions of the failure
"""
end_upload_failure = "Failed to establish a new connection"
failed_connectivity_test = "Connectivity test failed!"
Expand Down

0 comments on commit 5693a82

Please sign in to comment.