Skip to content

Conversation

@padovan
Copy link
Contributor

@padovan padovan commented Jul 2, 2025

This command was throwing us a 400 after some Dashboard API changes. Fix that and also add a test to make sure we don't regress.

padovan added 2 commits July 2, 2025 11:18
The hardware list command was failing due to two issues:

1. API parameter inconsistency: Used 'startTimestampInSeconds' instead
   of 'startTimestampInSeconds' (wrong case). Updated to match API spec
   and use string format as documented.

2. Response structure mismatch: Code expected 'hardware_name' field
   but API returns 'hardware' field (often null) and 'platform' field.
   Updated parser to use hardware field as fallback to platform.

Fixes the 400 Bad Request error and KeyError when running:
kci-dev results hardware list --origin maestro

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Adds comprehensive tests to verify the hardware list functionality:

1. test_kcidev_results_hardware_list: Tests standard text output format
   - Verifies command returns success (exit code 0)
   - Checks output contains expected '- name:' and 'compatibles:' patterns
   - Ensures matching number of hardware entries

2. test_kcidev_results_hardware_list_json: Tests JSON output format
   - Verifies JSON output is valid and parseable
   - Checks each entry has required 'name' and 'compatibles' fields
   - Validates field data types are strings as expected

These tests ensure the recent hardware list API fixes work correctly
and prevent future regressions.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
@aliceinwire aliceinwire merged commit c4a717a into kernelci:main Jul 3, 2025
5 checks passed
@aliceinwire
Copy link
Member

thanks

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