Skip to content

Deduplicate e2e test hook helpers#3412

Open
fspv wants to merge 1 commit intoyouki-dev:mainfrom
fspv:e2e-dedup-helpers
Open

Deduplicate e2e test hook helpers#3412
fspv wants to merge 1 commit intoyouki-dev:mainfrom
fspv:e2e-dedup-helpers

Conversation

@fspv
Copy link
Contributor

@fspv fspv commented Feb 18, 2026

Description

There is some duplication in the e2e tests for hooks. This PR moves similar functions to the helpers library so we can reuse them across the tests.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test updates
  • CI/CD related changes
  • Other (please describe):

Testing

  • Added new unit tests
  • Added new integration tests
  • Ran existing test suite
  • Tested manually (please provide steps)

Related Issues

#3406
#3408

Additional Context

Was raised here #3406 and here #3408
The functions in the tests in those PRs will be also deduplicated once they're landed and this PR is rebased on main.

Signed-off-by: Pavel Safronov <pv.safronov@gmail.com>
.args(vec![
"sh".to_string(),
"-c".to_string(),
format!("echo '{message}' >> {host_output_file}"),
Copy link
Member

Choose a reason for hiding this comment

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

What is {message}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, for different tests we want to write different messages. Like "prestart hook called" or whatever. Maybe the name of the function is not very obvious and I should call it something build_write_message_to_file_hook

Copy link
Member

Choose a reason for hiding this comment

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

Since it's only used in related hooks tests, how about creating a tests/hooks directory and moving the utils there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the problem is that tests/hooks already exists. And there is a test already defined there https://github.com/youki-dev/youki/blob/main/tests/contest/contest/src/tests/hooks/invoke.rs

I agree that it probably makes sense to put these functions somewhere separately, but not sure where. Does something like tests/contest/contest/src/tests/hook_utils look good?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you could just put it in the hooks dir along with the existing ones? Is there any reason you want to keep it separate from invoke.rs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants