Skip to content

Implementing test for graceful and immediate process termination - #1074

Open
SimonKozik wants to merge 10 commits into
eclipse-score:mainfrom
etas-contrib:graceful_and_immediate_process_shutdown_test
Open

SimonKozik wants to merge 10 commits into
eclipse-score:mainfrom
etas-contrib:graceful_and_immediate_process_shutdown_test

Conversation

@SimonKozik

@SimonKozik SimonKozik commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor
  • Cleaning up duplication in requirements.
  • Creating unit test that verifies following things:
    • Right signals are send for the right PID.
    • Signals are send in the right order (first SIGTERM, then SIGKILL).
    • Ensure that deployment_config.shutdown_timeout_ms is observed.
  • Additionally allowing shutdown_timeout_ms to be set to zero and thus enabling rapid shutdown of components if needed.

// No real child process is created; the parent path in ProcessLauncher stores
// the returned pid and returns kSuccess.
EXPECT_CALL(*g_syscall_mock, access(_, _)).WillRepeatedly(Return(0));
EXPECT_CALL(*g_syscall_mock, fork()).WillOnce(Return(kFakePid));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm tbh I was thinking in the CTs we shouldn't mock the syscalls. I don't think this would fail so what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In general, I don't see a reason to prohibit syscall mocks in CT tests. Mocks are a way to define test boundaries, and since CTs don't test the entire system, there will always be boundaries somewhere.

It seems strange to argue that syscalls are a boundary we should never mock.

Additionally, I chose a CT test because I believe it's important to verify that LM sends the correct signal, not just that the target process terminates.

For example, LM could theoretically send SIGLOST instead of SIGKILL. If the process uses the default signal handler, it would still terminate, and a test checking only for process termination could pass.

To verify that LM actually sends SIGKILL, we need to mock the syscall. Since SIGKILL cannot be caught, blocked, or ignored by the target process, we cannot verify the exact signal through a signal handler.

@SimonKozik
SimonKozik force-pushed the graceful_and_immediate_process_shutdown_test branch from ee67092 to aa0b498 Compare November 24, 2026 14:00
@SimonKozik
SimonKozik force-pushed the graceful_and_immediate_process_shutdown_test branch from ea700b4 to ad09209 Compare November 26, 2026 09:50
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-1074: https://eclipse-score.github.io/lifecycle/pr-1074/

@SimonKozik
SimonKozik force-pushed the graceful_and_immediate_process_shutdown_test branch from 2a4ad2b to c38eb16 Compare November 26, 2026 14:25
@SimonKozik
SimonKozik marked this pull request as ready for review November 26, 2026 14:29

This branch is waiting to be deployed

1 waiting deployment
workflow-approval — c38eb16a Waiting Nov 26, 2026 by SimonKozik via Build and test arm64-qnx / approval #2859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants