-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'VER-2324-stream-uvm-logs-in-test-driver' into 'master'
Stream uvm logs in the test-driver Test-driver can now [stream logs of all deployed uvms](https://dfinity.atlassian.net/browse/VER-2324). This aims at improving debugging experience. However, it comes with a cost of the increased logs size. [Here](https://dash.idx.dfinity.network/invocation/78fd727c-6e53-41c3-9223-16ccc965c077?target=%2F%2Frs%2Ftests%2Fnetworking%3Acanister_http_test) is an example of the `canister_http_test` log: ``` some logs ... ... // test-runner discovers a uvm in the env and starts streaming Journald entries 2023-06-21 09:33:04.920 INFO[uvms_logs_stream:rs/tests/src/driver/group.rs:563:0] Streaming Journald for newly discovered uvm=httpbin with ipv6=2a0b:21c0:4003:2:50dc:b2ff:fe21:a0ae ... // entries in Journald haven't appeared yet ... 2023-06-21 09:33:24.202 WARN[uvms_logs_stream:rs/tests/src/driver/group.rs:999:0] All entries of Journald are read to completion. Streaming Journald will start again in 5 sec ... // now entries in Journald appeared and are being streamed 2023-06-21 09:33:29.369 INFO[uvms_logs_stream:StdOut] [uvm=httpbin] JournalRecord {message: "kvm-clock: cpu 1, msr 57f3bb041, secondary cpu clock"} 2023-06-21 09:33:29.395 INFO[uvms_logs_stream:StdOut] [uvm=httpbin] JournalRecord {message: "pcieport 0000:00:01.5: PME: Signaling with IRQ 29"} ... ``` Around 1800 Journald entries of the `[uvm=httpbin]` are present in the log. Another important application of the feature is for running `colocated` tests. The test-runner deploys one `[uvm=test-driver]` and will stream all of its logs. `[uvm=test-driver]` in turn streams the logs of all the uvms that are deployed within the test, e.g. `[uvm=httpbin]`. Thus, test-runner will ultimately display all the logs. Here is an example for [canister_http_test_colocate](https://dash.idx.dfinity.network/invocation/b19ad835-92a0-42df-a737-d886d9f3c6b5?target=%2F%2Frs%2Ftests%2Fnetworking%3Acanister_http_test_colocate): ``` some logs ... ... // test-runner discovers the uvm in the env and starts streaming Journald entries 2023-06-21 08:58:21.476 INFO[uvms_logs_steam:rs/tests/src/driver/group.rs:563:0] Streaming Journald for newly discovered uvm=test-driver with ipv6=2600:c00:2:100:50af:81ff:fe16:a072 ... // example: log of the [uvm=test-driver] 2023-06-21 08:58:39.537 INFO[uvms_logs_steam:StdOut] [uvm=test-driver] JournalRecord {message: "Linux version 5.15.79 (nixbld@localhost) (gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.39) #1-NixOS SMP Wed Nov 16 08:58:31 UTC 2022"} .. // example: normal log of the test, thus `TEST_LOG` tag. 2023-06-21 09:01:09.412 INFO[uvms_logs_steam:StdOut] [uvm=test-driver] TEST_LOG: 2023-06-21 09:01:09.025 INFO[canister_http::http_basic::test:rs/tests/src/canister_http/http_basic.rs:84:0] Update call succeeded! Ok(RemoteHttpResponse { status: 200, headers: [], body: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>httpbin</title>\n</head>\n<body>\n <h1>httpbin</h1>\n</body>\n</html>There is context to be appended in body" }) ... // example: log of the [uvm=httpbin], which is first streamed to [uvm=test-driver] and then to the test-runner, thus nested: 2023-06-21 08:59:54.600 INFO[uvms_logs_steam:StdOut] [uvm=test-driver] TEST_LOG: 2023-06-21 08:59:53.925 INFO[uvms_logs_steam:StdOut] [uvm=httpbin] JournalRecord {message: "BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable"} ``` Implementation remarks: - A separate background `uvms_logs_stream_task` is created, which is the parent of `keepalive_task` - uvms discovering is retried and performed in all env folder. Thus, one can deploy uvms in setup, test, or other tasks. - uvms logs streaming is retried in case of errors or if the logs are read to completion TODOs: - Limit the max number of Journald entries to avoid overflow See merge request dfinity-lab/public/ic!12591
- Loading branch information
Showing
3 changed files
with
289 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.