testsuite icon indicating copy to clipboard operation
testsuite copied to clipboard

[Feature] Uniform way of logging spec test output

Open macaktom opened this issue 11 months ago • 2 comments

Is your feature request related to a problem? Please describe. Right now, there is a lot of repetition regarding spec test outputs and there are multiple ways of logging outputs (Log and LOGGING).

Good example could be cluster_api_spec.cr

image

  1. Log.info and LOGGING.info -> multiple ways how to log result
  2. multiple repetition of assigning result to variable (resp, response_s) and it's logging.

Describe the solution you'd like A clear and concise description of what you want to happen.

  1. Think of uniform way to output spec results -> for example wrapper function, which would encapsulate result of shell command and output it if needed (wrapper would encapsulate variable assignment and output of that variable).
  2. Replace instances with Log and Logging with implemented wrapper function.

How will this be tested? aka Acceptance Criteria (optional)

  1. Running all spec tests in debug mode
  2. Running all spec tests in error mode

(optional: unnecessary for things like some version bumps etc.)

Goal is to avoid repetition and have one way to log output of shell commands. Maybe this could also be applicable to workload and platform tests (need to be checked).

macaktom avatar Mar 06 '24 13:03 macaktom

In some logs from spec tests I saw this (just snippet from middle of the log): `I, [2024-02-28 13:51:42 +01:00 #765697] INFO -- cnf-testsuite: task_type x: bonus acc: cert I, [2024-02-28 13:51:42 +01:00 #765697] INFO -- cnf-testsuite: task_type: bonus I, [2024-02-28 13:51:42 +01:00 #765697] INFO -- cnf-testsuite: upsert_task: task: no_local_volume_configuration has status: passed and is awarded: 1 points. Runtime: 276 seconds I, [2024-02-28 13:51:42 +01:00 #765697] INFO -- cnf-testsuite: results yaml: {"name" => "cnf testsuite", "testsuite_version" => "privileged_test_1906-2024-02-28-135141-e54218b7", "status" => nil, "command" => "/home/horecoli/git/cnf-testsuite/cnf-testsuite no_local_volume_configuration verbose", "points" => nil, "exit_code" => 0, "items" => [{"name" => "no_local_volume_configuration", "status" => "passed", "type" => "bonus", "points" => 1}]}

.2024-02-28T12:51:43.284210Z INFO - KubectlClient::Get.resource command: kubectl get configmaps docker-config -o json -n cnf-testsuite 2024-02-28T12:51:43.376182Z INFO - Skipping docker-config. ConfigMap exists. 2024-02-28T12:51:43.376184Z INFO - Install dockerd from manifest`

In code snippet above is visible that logging is using different timezone [2024-02-28 13:51:42 +01:00 #765697] VS 2024-02-28T12:51:43.284210Z. I think that this is additional reason to somehow unify this logging.

horecoli avatar Mar 06 '24 16:03 horecoli

Being fixed in https://github.com/cnti-testcatalog/testsuite/pull/1954

kosstennbl avatar May 03 '24 07:05 kosstennbl

Fixed in #1954

kosstennbl avatar Sep 04 '24 21:09 kosstennbl