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

Add hostname test #1376

Merged
merged 4 commits into from Dec 2, 2022
Merged

Conversation

chermehdi
Copy link
Contributor

@chermehdi chermehdi commented Nov 27, 2022

The test is ported from https://github.com/opencontainers/runtime-tools/blob/2802ff9ff5/validation/hostname/hostname.go

The intent is to make sure that the hostname set in the spec is actually set within the container.

Signed-off-by: chermehdi mehdi.cheracher@gmail.com

The test is ported from https://github.com/opencontainers/runtime-tools/blob/2802ff9ff5/validation/hostname/hostname.go

The intent is to make sure that the hostname set in the spec is actually set within the
container.

Signed-off-by: chermehdi <mehdi.cheracher@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2022

Codecov Report

Merging #1376 (1ed2adb) into main (17c279b) will increase coverage by 0.00%.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1376   +/-   ##
=======================================
  Coverage   68.80%   68.80%           
=======================================
  Files         119      119           
  Lines       12586    12664   +78     
=======================================
+ Hits         8660     8714   +54     
- Misses       3926     3950   +24     

@utam0k utam0k requested a review from YJDoc2 November 27, 2022 23:43
Copy link
Collaborator

@YJDoc2 YJDoc2 left a comment

Choose a reason for hiding this comment

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

Hey, I have suggested some changes, please take a look

* Fix capitalisation in error messages.
* Split tests into individual methods.

Signed-off-by: chermehdi <mehdi.cheracher@gmail.com>
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Nov 29, 2022

@chermehdi I have updated my comment, please take a look

Signed-off-by: chermehdi <mehdi.cheracher@gmail.com>
@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 1, 2022

Hey, mostly it is correct, but instead of removing the condition altogether, can you just return from the if-block? It will also indicate that we meant to return if no paths were given in the test instead of a potentially ambiguous the case of empty paths is not considered if someone has to update the that test later.

Also, please amend the last commit instead of adding new commit for this 😃

@chermehdi
Copy link
Contributor Author

That's what I had initially, but it's moot, since the loop below wouldn't run if the ro_paths is empty so no extra tests would run, the behavior is as expected with less code.

about commits, I don't really put too much attention on amending commits as I assume we will squash all of them at the end of the day when merging, It just gives a better history line when looking at the PR for what changes happened and why/when.

@YJDoc2
Copy link
Collaborator

YJDoc2 commented Dec 1, 2022

That's what I had initially, but it's moot, since the loop below wouldn't run if the ro_paths is empty so no extra tests would run, the behavior is as expected with less code.

I can understand that the loop will not run if empty array, but we should have some sign that we have considered the empty array case, and the behavior is intentional. Also, we usually don't squash commits, but in this case, sure I'll squash this PR for merge

Signed-off-by: chermehdi <mehdi.cheracher@gmail.com>
Copy link
Collaborator

@YJDoc2 YJDoc2 left a comment

Choose a reason for hiding this comment

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

lgtm 👍 Thanks for your contribution!

@YJDoc2 YJDoc2 merged commit 93384b5 into containers:main Dec 2, 2022
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.

None yet

3 participants