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

namespaces test - refactoring and cleanup #3186

Merged

Conversation

edsantiago
Copy link
Member

Followup to #3173 - just a little further cleanup of idmapping
test. Plus, oops, fix a longstanding error-failure bug

Signed-off-by: Ed Santiago [email protected]

Followup to containers#3173 - just a little further cleanup of idmapping
test. Plus, oops, fix a longstanding error-failure bug

Signed-off-by: Ed Santiago <[email protected]>
Copy link
Member Author

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

Hints for reviewers.

@@ -63,58 +63,37 @@ load helpers
# Check that with settings that don't require a user namespace, we can request to use a per-container network namespace.
run_buildah run $RUNOPTS --net=container "$ctr" readlink /proc/self/ns/net
if [[ $output == $mynetns ]]; then
expect_output "[output should not be '$mynetns']"
die "[/proc/self/ns/net (--net=container) should not be '$mynetns']"
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops: this and the next were mistakes I made in #2029

Comment on lines -75 to -79
idmapping_check_namespace() {
local _uidmapargs=$1
local _gidmapargs=$2
local _mynamespace=$3
local _output=$4
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now a localized function, defined within the appropriate for loop, because the uid/gid/mynamespace args really should not be args

Comment on lines -91 to -95
idmapping_check_map() {
local _output_uidmap=$1
local _output_gidmap=$2
local _expect_uidmap=$3
local _expect_gidmap=$4
Copy link
Member Author

Choose a reason for hiding this comment

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

Converted to check a generic X id map, to avoid the duplicate complicated sed lines. It's better IMO to have two calls to this function, one with UID and one with GID, than to duplicate the complicated sed stuff.


expect_output --from="${_output_file_stat}" "1:1" "Check if a copied file gets the right permissions"
expect_output --from="${_output_dir_stat}" "0:0" "Check if a copied directory gets the right permissions"
expect_output --from="${_output_otherfile_stat}" "${_expect_otherfile_stat}" "Check if another copied file gets the right permissions"
Copy link
Member Author

Choose a reason for hiding this comment

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

There really is no reason for this to be in a helper; it just complicates arg passing.

@rhatdan
Copy link
Member

rhatdan commented Apr 27, 2021

LGTM

@rhatdan
Copy link
Member

rhatdan commented Apr 28, 2021

/approve
@containers/buildah-maintainers PTAL

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cevich
Copy link
Member

cevich commented Apr 28, 2021

Holy sed! Let's hope the uid/gidmap format never ever changes 😀

/lgtm

@openshift-merge-robot openshift-merge-robot merged commit b03d305 into containers:master Apr 28, 2021
@edsantiago edsantiago deleted the namespace_refactor branch April 28, 2021 19:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants