Get smoke test 1 running again + include "is_unmessagable" in export/import of configurations
Overview of changes and motivation
-
Adding "is_unmessagable" to config Idea was first to add the "is_unmessagable" flag to the export/import of configurations. This seemed to be a straight forward change not touching too much functions.
-
Problems with smoke test After implementing this and starting with the smoke test, I found that 50% of those tests did not pass - far too much for me to be acceptable.
There have been several reasons for those problems:
- the radios are quite slow and especially a reboot takes lot of ressources for a certain time. This might block the communication. Especially the RAK device also cuts the serial line during the reboot which leads to time-outs.
- The tests rely on a radio status set when successfully finishing a test. When the test fails, the status might be different, thus the next test(s) will also fail. Proper setup often is missing.
- Missing functions to validate the channel status and to set it to a given state.
- Packets not behaving the same when used in tests (tabulate, yaml)
- Changes induced by smoke test In order to get smoke test running correctly, I had to add some missing functions, mainly on the node side and for channel handling. It turned out, that there is no (internal) function at all to reset all channels - which is at least needed when a configuration is loaded.
Test Results
- Unit tests pass 100%
- integration test pass 100%
- smoke test 1 pass 100% for HelTec running in Win/Lin, also 100% for RAK in Windows. RAK device gets blocked in Linux from time to time.
- Build: no tested, environment not ready.
Design Problems to be discussed further
- When to clear secondary channels: when loading a config only or there are other occasions?
- Updating channel config on radio: reversed updates from the latest to the first channel to avoid writing an existent set on another index. This might have side effects. To be reviewed.
- Semantics of URL: In the info there are 2 URLs given. One for the primary channel and one for the whole setting. When applying the URL for the primary channel, it will overwrite it with these settings and not touching the secondary channels. Is this the right interpretation? What is then the function of the second, full URL? Will it overwrite just the channels which are defined and not touch the others? There might be users expecting that such an URL will just erase everything and set new occording to the URL. Has this been discussed already?
- In some cases, settings are not transferred correctly to the radio and the CLI does not recognize this. I encountered this problem mostly on Linux, in Windows it seems to work so far. I will open an issue later on this with some additional analysis.
Detailed Changes
- "main.py"
- read/write
is_unmessagablefrom/to configuration file - refactor
args.configure: extract common code, callsetOwner()once with all user settings. Ensure, that reading of yaml also works within pytest (read first text, then pass to yaml) - add "--ch-info" parameter to export a full channel set including deleted and disabled channels
args.showNodes: add parameterprintFmtto be able to force a json output circumventing table generation which always fails during test- logging: add capability (parameter --logTo) to log debug messages to a file for easier analysis of output. Adding timestamp, full command line and "orientation marks" to be able to visually navigate in a larger debug file
export_config(): refactoring, adding types, cleaning code
- read/write
- "node.py": extend
showChannels()to show everything, add function to delete all secondary channels (used inargs.config). Rewriting of a new channel list now starts at the end, so that the radio does never get double channel definitions during the update. Removinglogger.info()calls to streamline CLI output. - "test_smoke1.py": create helper functions for reboot, set URL and check qr. Especially, check that the communication is back after a reboot. Add capability to pass
--debugflag during the tests to store a debug log for later analysis. Store the current config temporarly and reload it at the end to avoid accidential operation in wrong region and to have the device always with a valid configuration. Reviewed all tests and improved/refined where necessary. Added a special configuration to reset channels to a known state before testing. - "test_node.py": add a helper function to initialize the channel set to a known, empty state with one primary channel. Will be used within the tests of main to mock a local node.
- "test_main.py": Changes to reflect the additions in main.py. Rework test functions
test_main_configure_with_snake_case()andtest_main_configure_with_camel_case_keys()to do a real test (actually it did nothing because the config was not read correctly) - example configurations: added "is_unmessagable" setting for testing
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.