Skip to content

test: add integration tests for rhc collector CLI - #540

Draft
Archana-PandeyM wants to merge 1 commit into
mainfrom
arpandey/rhcCollectorCLITests
Draft

test: add integration tests for rhc collector CLI#540
Archana-PandeyM wants to merge 1 commit into
mainfrom
arpandey/rhcCollectorCLITests

Conversation

@Archana-PandeyM

Copy link
Copy Markdown
Contributor

Covers rhc list, info, and timers against the packaged com.redhat.minimal collector.

Resolves : CCT-2712

@Archana-PandeyM
Archana-PandeyM marked this pull request as draft August 4, 2026 10:57
Cover list, info, and timers against the packaged com.redhat.minimal collector.

Resolves : CCT-2712
@Archana-PandeyM
Archana-PandeyM force-pushed the arpandey/rhcCollectorCLITests branch from 986cfa6 to 32878fc Compare August 6, 2026 08:59
@Archana-PandeyM
Archana-PandeyM marked this pull request as ready for review August 6, 2026 09:15
@stephenbourke

Copy link
Copy Markdown
Contributor

Thanks @Archana-PandeyM ,

Just to note @mjcr99 has a refactor PR on this same area #542
Hopefully there is not too much code conflict.



@pytest.mark.tier2
def test_collector_cli_info(rhc, minimal_collector, minimal_timer_cache):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think minimal_timer_cache fixture is used here?



@pytest.fixture(scope="module")
def rhc_server_socket():

@stephenbourke stephenbourke Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional to have a duplicate function of what is in test_collector_api.py? It will be moved in #542.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, lets first merge #542 and then I will refactor this PR again.

"tracked by RHEL-217910."
)
)
def test_collector_cli_list_format_json(rhc, minimal_collector):

@stephenbourke stephenbourke Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's useful have a check for expected output on invalid formats?
e.g.

rhc collector info --format yaml
unsupported format: yaml (supported formats: "json")`

result = rhc.run("collector", "info", minimal_collector["id"], check=False)

assert result.returncode == 0
assert f"Name: {minimal_collector['name']}" in result.stdout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about a looser match rather than exact spacing? It might make the tests a little less likely to break if the format drifts.

"Name:" in result.stdout and minimal_collector['name'] in result.stdout

Or maybe a regex allowing for any number of spaces?

r"Name:\s+Minimal Host…"

@Archana-PandeyM
Archana-PandeyM marked this pull request as draft August 7, 2026 08:09
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