Skip to content

Add more tests for ctr_logging.c#607

Merged
jnovy merged 1 commit intocontainers:mainfrom
jankaluza:logging-tests
Oct 7, 2025
Merged

Add more tests for ctr_logging.c#607
jnovy merged 1 commit intocontainers:mainfrom
jankaluza:logging-tests

Conversation

@jankaluza
Copy link
Member

This commit adds tests for:

  • the --log-label option.
  • the --log-tag option.
  • the parsing of journald priority level.
  • the partial message in both journald and k8s-file.
  • the log rotation using the ctl command.

@jankaluza
Copy link
Member Author

This depends on #605. I will rebase it once #605 is done.

@jankaluza
Copy link
Member Author

@jnovy , this is ready for review now.

@jankaluza jankaluza force-pushed the logging-tests branch 2 times, most recently from c9702cd to cf7a9c0 Compare September 26, 2025 09:54
test_resize_command_ok "1 65535 65535" "24 80"
}

@test "ctrl: rotate logs with --log-rotate" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove:

@test "ctrl: rotate logs" {
    start_conmon_with_default_args --log-path "k8s-file:$LOG_PATH" -t
    wait_for_runtime_status "$CTR_ID" running

    # Remove the log.
    rm -f $LOG_PATH
    # The control message should reopen/recreate it.
    echo "2 1 1" > ${CTL_PATH}

    start_conmon_with_default_args \
        --log-path "k8s-file:$LOG_PATH.exec" \
        --exec \
        --exec-process-spec "${BUNDLE_PATH}/process.json"

    wait_for_runtime_status "$CTR_ID" stopped

    # Check that the log exists now.
    assert_file_exists "$LOG_PATH"
    run cat "$LOG_PATH"
    # No terminal resize
    assert "${output}" =~ "standard input"
}

As you r new test tests the same thing more throughly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test actually tests that you can rotate logs using the control message. This is different scenario than the ones in the 03-k8s-log-rotation.bats.

This commit adds tests for:
- the `--log-label` option.
- the `--log-tag` option.
- the partial message in both journald and k8s-file.
- the log rotation using the `ctl` command.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
@jnovy jnovy merged commit 99906d3 into containers:main Oct 7, 2025
32 of 35 checks passed
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