action #153763
Updated by livdywan 11 months ago
## Motivation From https://suse.slack.com/archives/C02AJ1E568M/p1705482261366879?thread_ts=1705481511.459859&cid=C02AJ1E568M > (Oliver Kurz) maybe changes have broken the dry run > (Tina Müller) yeah, line 161 is doing a openqa-cli POST request and expecting a JSON response. that won't work if it's replaced with an echo Command-line used: (Ioannis Bonatakis) host=aquarius.suse.cz dry_run=1 exclude_no_group=false ./openqa-investigate 20047 jq (161 ./openqa-investigate): jq: parse error: Invalid numeric literal at line 1, column 11 (rc: 5 Input: >>>openqa-cli api --header User-Agent: openqa-investigate (https://github.com/os-autoinst/scripts) --host https://aquarius.suse.cz --retries=3 -X POST jobs/20047/comments text=Starting investigation for job 20047<<<) ## Acceptance Criteria * **AC1:** Dry > (Oliver Kurz) maybe changes have broken the dry run does not fail ## Suggestions * The code > (Tina Müller) yeah, line 161 is POSTing doing a comment openqa-cli POST request and then GETting it back, so we need to mock the response(s) * Alternatively to mocking, add some input validation to the code block in question and make it do nothing * e.g. add expecting a JSON response. that won't work if it's replaced with an early return in `sync_via_investigation_comment()` echoing a made-up comment id echo * Add a unit test for it (Test-Driven Development) * "dry run" should be understood to potentially read data from external services, but never modify anything or write changes back -> Don't leave behind any traces * Consider documenting this somewhere