Skip to content

namespaces test - refactoring and cleanup - #3186

Merged
openshift-merge-robot merged 1 commit into
podman-container-tools:masterfrom
edsantiago:namespace_refactor
Apr 28, 2021
Merged

namespaces test - refactoring and cleanup#3186
openshift-merge-robot merged 1 commit into
podman-container-tools:masterfrom
edsantiago:namespace_refactor

Conversation

@edsantiago

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Ed Santiago santiago@redhat.com

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

Signed-off-by: Ed Santiago <santiago@redhat.com>

@edsantiago edsantiago left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hints for reviewers.

Comment thread tests/namespaces.bats
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
Copy Markdown
Contributor 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 thread tests/namespaces.bats
Comment on lines -75 to -79
idmapping_check_namespace() {
local _uidmapargs=$1
local _gidmapargs=$2
local _mynamespace=$3
local _output=$4

Copy link
Copy Markdown
Contributor 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 thread tests/namespaces.bats
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
Copy Markdown
Contributor 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.

Comment thread tests/namespaces.bats

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
Copy Markdown
Contributor 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

rhatdan commented Apr 27, 2021

Copy link
Copy Markdown
Contributor

LGTM

@rhatdan

rhatdan commented Apr 28, 2021

Copy link
Copy Markdown
Contributor

/approve
@containers/buildah-maintainers PTAL

@openshift-ci-robot

Copy link
Copy Markdown

[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

Details 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

cevich commented Apr 28, 2021

Copy link
Copy Markdown
Contributor

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

/lgtm

@openshift-merge-robot
openshift-merge-robot merged commit b03d305 into podman-container-tools: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