Skip to content

Add IoT image url check in collector (New) #1867

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Artur-at-work
Copy link
Contributor

@Artur-at-work Artur-at-work commented Apr 16, 2025

Description

Adds a test case to get URL of the image installed on IoT device
PC and IOT devices have different DCD strings formats, thus existing PC parser does not support url generation for IoT devices.
This change will add a check in collector to parse the dcd file for IoT devices first. When this file is missing, we assume that platform is PC and use the PC parser instead.

Resolved issues

Closes https://warthogs.atlassian.net/browse/OEX86-682

Documentation

N/A

Tests

Added unittest for IoT dcd format and url

$ python3 -m unittest plainbox/vendor/test_image_info.py -v
test_fail_no_dcd_output (plainbox.vendor.test_image_info.TestDCDStringE2E.test_fail_no_dcd_output) ... Parsed report: {"Version": "24.04", "BIOS": {"Vendor": "Some Inc.", "Version": "0.1.20"}, "Arch": "amd64", "HwCap": "x86-64-v3", "GPU": [{"Vendor": "0000", "Model": "0000"}], "RAM": 16, "Partitions": [477.7, 1.1], "Autologin": true, "LivePatch": false, "Session": {"DE": "", "Name": "", "Type": "tty"}, "Language": "en_US", "Timezone": "Etc/UTC", "Install": {"Type": "Flutter", "OEM": false, "Media": "Ubuntu OEM 24.04.1 LTS", "Stages": {"20": "loading", "218": "done"}}}
ok
test_ok_output (plainbox.vendor.test_image_info.TestDCDStringE2E.test_ok_output) ... Parsed report: {"Version": "24.04", "OEM": {"Vendor": "Some Inc.", "Product": "13312", "Family": "NOFAMILY", "DCD": "canonical-oem-pinktiger-noble-oem-24.04a-20240823-74"}, "BIOS": {"Vendor": "Some Inc.", "Version": "0.1.20"}, "Arch": "amd64", "HwCap": "x86-64-v3", "GPU": [{"Vendor": "0000", "Model": "0000"}], "RAM": 16, "Partitions": [477.7, 1.1], "Autologin": true, "LivePatch": false, "Session": {"DE": "", "Name": "", "Type": "tty"}, "Language": "en_US", "Timezone": "Etc/UTC", "Install": {"Type": "Flutter", "OEM": false, "Media": "Ubuntu OEM 24.04.1 LTS", "Stages": {"20": "loading", "218": "done"}}}
ok
test_dcd_info_iot_path_all_fields (plainbox.vendor.test_image_info.TestDCDStringE2EIoT.test_dcd_info_iot_path_all_fields) ... Found IoT dcd string: canonical-oem-carlsbad:element-v2-uc24:20241205.15:v2-uc24-x01
ok
test_dcd_info_iot_path_no_additional_info (plainbox.vendor.test_image_info.TestDCDStringE2EIoT.test_dcd_info_iot_path_no_additional_info) ... Found IoT dcd string: canonical-oem-shiner:x8high35-som-pdk:20250507-1170:
ok
test_dcd_info_iot_path_not_exists (plainbox.vendor.test_image_info.TestDCDStringE2EIoT.test_dcd_info_iot_path_not_exists) ... Parsed report: {"Version": "24.04", "OEM": {"Vendor": "Some Inc.", "Product": "13312", "Family": "NOFAMILY", "DCD": "canonical-oem-pinktiger-noble-oem-24.04a-20240823-74"}}
ok
test_len_5 (plainbox.vendor.test_image_info.TestDCDStringToInfo.test_len_5) ... ok
test_len_6 (plainbox.vendor.test_image_info.TestDCDStringToInfo.test_len_6) ... ok
test_len_7 (plainbox.vendor.test_image_info.TestDCDStringToInfo.test_len_7) ... ok
test_len_wrong (plainbox.vendor.test_image_info.TestDCDStringToInfo.test_len_wrong) ... ok
test_invalid_dcd_formats (plainbox.vendor.test_image_info.TestDCDStringToInfoIoT.test_invalid_dcd_formats) ... ok
test_valid_dcd_no_additional_info (plainbox.vendor.test_image_info.TestDCDStringToInfoIoT.test_valid_dcd_no_additional_info) ... ok
test_valid_dcd_with_all_fields (plainbox.vendor.test_image_info.TestDCDStringToInfoIoT.test_valid_dcd_with_all_fields) ... ok

----------------------------------------------------------------------
Ran 12 tests in 0.002s

OK
{"base_url": "https://oem-share.canonical.com/partners", "project": "pinktiger", "series": "noble", "kernel_type": "24.04a", "build_date": "20240823", "build_number": "74", "url": "https://oem-share.canonical.com/partners/pinktiger/share/releases/noble/24.04a/20240823-74/"}

@Artur-at-work Artur-at-work marked this pull request as draft April 16, 2025 05:49
@Hook25
Copy link
Collaborator

Hook25 commented Apr 16, 2025

Hello, we have a new collector in checkbox that should always put the image information in the submission.json under system_information.image_info. Have you found this information incomplete/failing to parse sometimes or..?

@Artur-at-work
Copy link
Contributor Author

hi @Hook25,
As I understand, you've implemented it in image_info.py On IoT devices, the dcd string is stored in the file and it's format is quite different from the PC. It will require different conversion rule to get the URL.
Are you planning to expand the image_info to cover the IoT url? If yes, I don't have to merge this test case...

@Hook25
Copy link
Collaborator

Hook25 commented Apr 16, 2025

having the collector work in every situation would be nice, especially because it would include the information in all test runs you do, not just the ones that have this job included, but also because the information is always in the same place and parsed by C3, so it is easier to display.

There was a spec a while back about these strings, are you saying that IoT is not following the spec or that the parser I wrote doesn't understand the spec?

@Artur-at-work
Copy link
Contributor Author

Artur-at-work commented Apr 16, 2025

The parser you wrote for PC looks good to me.
IoT is not following that spec, because their image naming is different. That's why I wanted to add another test case.
Or should I propose the change to the image_info.py?

@Artur-at-work Artur-at-work marked this pull request as ready for review April 18, 2025 02:31
@Artur-at-work
Copy link
Contributor Author

Just FYI, DCD file for IoT is stored in different location "/run/mnt/ubuntu-seed/.disk/info".
If it exists, we could use IoT url parsing logic, else fall back to PC parser.
Unless there's a better way to differentiate iot vs pc.

@Hook25
Copy link
Collaborator

Hook25 commented Apr 22, 2025

I really like your idea! Ping me once you have it I will give it a look

@Hook25 Hook25 marked this pull request as draft April 29, 2025 12:44
@Artur-at-work Artur-at-work changed the title A case to get IoT image url (New) Add IoT image url check in collector (New) May 19, 2025
Copy link

codecov bot commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.11%. Comparing base (eb41688) to head (cdd4c98).
Report is 67 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1867      +/-   ##
==========================================
+ Coverage   49.96%   50.11%   +0.14%     
==========================================
  Files         378      378              
  Lines       40768    40819      +51     
  Branches     6859     6856       -3     
==========================================
+ Hits        20370    20455      +85     
+ Misses      19670    19626      -44     
- Partials      728      738      +10     
Flag Coverage Δ
checkbox-ng 70.22% <ø> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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