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

feat(test): Adding docstrings to test_checkin.py #288

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions integration-tests/test_checkin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"""
:casecomponent: insights-client
:requirement: RHSS-291297
:subsystemteam: sst_csi_client_tools
:caseautomation: Automated
:upstream: Yes
"""

import contextlib
import json

import pytest
from constants import HOST_DETAILS
import conftest
Expand All @@ -9,8 +16,29 @@


def test_ultralight_checkin(insights_client, test_config):
"""test --checkin
Sends nothing but canonical facts to update the host stale and updated timestamp
"""
:id: c662fd5e-0751-45e4-8477-6b0d27f735ac
:title: Test lightweight check-in updates staleness timestamps
:description:
This test verifies that performing an ultra-light check-in with the
insights-client updates the host's 'stale_timestamps' and 'updated'
fields on the server
:reference:
:tier: Tier 2
:steps:
1. Register the insights-client
2. Run '--check-results' and record the 'stale_timestamp' and 'updated'
timestamps before check-in
3. Perform an ultra-light check-in ny running '--checkin'
4. Run '--check-results' and record the 'stale_timestamp' and 'updated'
timestamps again
5. Verify that timestamps were updated successfully
:expectedresults:
1. Insights-client is registered
2. The initial timestamps were retrieved and recorded
3. The check-in completes without any errors
4. The updated timestamps were retrieved and recorded
5. Both updated timestamps will be greater than before check-in
"""
insights_client.register()
assert conftest.loop_until(lambda: insights_client.is_registered)
Expand All @@ -36,7 +64,22 @@ def test_ultralight_checkin(insights_client, test_config):


def test_client_checkin_unregistered(insights_client):
"""Call insights client check-in with unregistered client."""
"""
:id: 91331995-20c2-4d44-8abe-74a3e7d28309
:title: Test check-in fails for unregistered client
:description:
This test verifies that attempting to perform check-in while unregistered
fails with appropriate error message
:reference:
:tier: Tier 1
:steps:
1. Unregister the insights-client if registered
2. Attempt to perform a check-in by running '--checkin'
:expectedresults:
1. Insights-client is unregistered successfully
2. The check-in fails with return code 1 and message 'Error: failed
to find host with matching machine-id'
"""
with contextlib.suppress(Exception):
insights_client.unregister()
assert conftest.loop_until(lambda: not insights_client.is_registered)
Expand Down
Loading