Skip to content

Conversation

Sativarsainath-26
Copy link
Contributor

resolves: containers/podman#23852

Modified only policy.json file to resolve above issue ---> if this implementation looks Good will modify unit-test cases also.

@rhatdan
Copy link
Member

rhatdan commented Sep 24, 2024

LGTM
@mtrmac PTAL

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks! The feature makes sense.

For signature, we want as close to 100% code coverage by unit tests as possible, and for that I suspect the implementation will need to change, so that it doesn’t rely on the presence/absence of systemDefaultPolicyPath on the host where the tests are running.

@mtrmac
Copy link
Collaborator

mtrmac commented Sep 24, 2024

Looks good, still needs test coverage.

@Sativarsainath-26
Copy link
Contributor Author

Looks good, still needs test coverage.

I will take a look on this,, will try to make it 100%.

@Sativarsainath-26
Copy link
Contributor Author

Thanks! The feature makes sense.

For signature, we want as close to 100% code coverage by unit tests as possible, and for that I suspect the implementation will need to change, so that it doesn’t rely on the presence/absence of systemDefaultPolicyPath on the host where the tests are running.

To avoid dependency on presence/absence of systemDefaultPolicyPath --> Any ideas you have to resolve this @mtrmac .

@mtrmac
Copy link
Collaborator

mtrmac commented Sep 24, 2024

Use a separate parameter for the implementation, just like defaultPolicyPathWithHomeDir does for the home directory.

@Sativarsainath-26
Copy link
Contributor Author

Use a separate parameter for the implementation, just like defaultPolicyPathWithHomeDir does for the home directory.

@mtrmac I added unit-test case by removing dependency on systemDefaultPolicyPath . Please take a look . Is this as per expectation or not 😟 ?

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

Approach looks perfect overall; a few nits to make future maintenance easier.

}
path, err := defaultPolicyPathWithHomeDir(c.sys, tempHome, tempsystemdefaultpath)
if c.expectedError != "" && err != nil {
assert.Empty(t, path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

(If err is set, we are making no promises on path, it must not be used; this line, to the extent it might imply such a promise, is not really desirable and I think it’s better to remove it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I understood your point.

@mtrmac
Copy link
Collaborator

mtrmac commented Sep 26, 2024

Also, eventually, please squash the commits into one; for git bisect it’s better when all commits are buildable.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

Good improvements; two more things, please.

@Sativarsainath-26
Copy link
Contributor Author

Also, eventually, please squash the commits into one; for git bisect it’s better when all commits are buildable.

Thank you for all your reviews and suggestions on this PR. It was a great learning experience.

Signed-off-by: Sainath Sativar <Sativar.sainath@gmail.com>
Signed-off-by: Sainath Sativar <Sativar.sainath@gmail.com>
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks for all that work!

@mtrmac mtrmac merged commit 344b34b into containers:main Oct 1, 2024
10 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.

error message for missing policy.json only mentions /etc/containers/policy.json
3 participants