Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: hooks integration test #959

Merged
merged 1 commit into from
Jun 18, 2022

Conversation

tony84727
Copy link
Contributor

@tony84727 tony84727 commented Jun 4, 2022

Add hooks integration test

See #361

Signed-off-by: Tony Duan tony84727@gmail.com

Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

@tony84727 Thanks for your PR. Great! I left a comment, please check.

.hooks(
HooksBuilder::default()
.prestart(vec![
write_log_hook("pre-start1 called"),
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to call twice per-hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's ported from here:
https://github.com/opencontainers/runtime-tools/blob/0105384f68e16803891d0a17d9067b1def6a2778/validation/hooks/hooks.go#L32-L67
I was having the same question. I guess calling twice is to ensure the implementation actually executes hooks in the given order. (hook 1 then hook 2 in sequence)

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2022

Codecov Report

Merging #959 (859c217) into main (99fe4f8) will increase coverage by 0.11%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #959      +/-   ##
==========================================
+ Coverage   69.12%   69.23%   +0.11%     
==========================================
  Files         118      118              
  Lines       12460    12440      -20     
==========================================
  Hits         8613     8613              
+ Misses       3847     3827      -20     

@tony84727
Copy link
Contributor Author

Test failed. I will look into this. Maybe it's a race condition of hooks writing logs?

@utam0k
Copy link
Member

utam0k commented Jun 15, 2022

@tony84727 This indicates that the runc did not pass the test, not youki. We run integration tests on runc to verify the integration tests themselves.

# Start group hooks
1 / 1 : hooks : not ok
	error : hooks must be called in the listed order

@tony84727
Copy link
Contributor Author

@tony84727 This indicates that the runc did not pass the test, not youki. We run integration tests on runc to verify the integration tests themselves.

# Start group hooks
1 / 1 : hooks : not ok
	error : hooks must be called in the listed order

👌 I've made runc pass hooks test on my machine. Somehow, for hooks to write logs, we need to specify absolute path instead of simply output. I'm not sure why.

@tony84727 tony84727 requested a review from utam0k June 16, 2022 06:16
See youki-dev#361

Signed-off-by: Tony Duan <tony84727@gmail.com>
@utam0k utam0k merged commit c1d8b62 into youki-dev:main Jun 18, 2022
@tony84727 tony84727 deleted the integration-test/hooks branch June 18, 2022 13:41
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.

3 participants