Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nxdtest
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
nxdtest
Commits
94dd2c20
Commit
94dd2c20
authored
Dec 09, 2021
by
Jérome Perrin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! trun: Spawn user test with sole regular uid/gid in /etc/{passwd,group} database
parent
2bb7dc04
Pipeline
#18741
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
nxdtest/nxdtest_test.py
nxdtest/nxdtest_test.py
+22
-0
nxdtest/testprog/tdumpusergroups
nxdtest/testprog/tdumpusergroups
+36
-0
No files found.
nxdtest/nxdtest_test.py
View file @
94dd2c20
...
@@ -19,7 +19,9 @@
...
@@ -19,7 +19,9 @@
# verify general functionality
# verify general functionality
import
grp
import
os
import
os
import
pwd
import
sys
import
sys
import
re
import
re
import
time
import
time
...
@@ -261,6 +263,26 @@ TestCase('TESTCASE', ['mount', '-t', 'tmpfs', 'none', '/etc'])
...
@@ -261,6 +263,26 @@ TestCase('TESTCASE', ['mount', '-t', 'tmpfs', 'none', '/etc'])
assert
"# leaked mount: none /etc tmpfs"
in
captured
.
out
assert
"# leaked mount: none /etc tmpfs"
in
captured
.
out
# verify user mapping
def
test_run_usermap
(
run_nxdtest
,
capsys
):
tdumpusergroups
=
"%s/testprog/tdumpusergroups"
%
(
dirname
(
__file__
),)
run_nxdtest
(
"""
TestCase('TESTCASE', %r)
"""
%
[
tdumpusergroups
])
captured
=
capsys
.
readouterr
()
assert
captured
.
err
==
''
assert
repr
(
pwd
.
getpwnam
(
'root'
))
in
captured
.
out
.
splitlines
()
assert
repr
(
pwd
.
getpwnam
(
'nobody'
))
in
captured
.
out
.
splitlines
()
assert
repr
(
pwd
.
getpwuid
(
os
.
getuid
()))
in
captured
.
out
.
splitlines
()
assert
repr
(
grp
.
getgrnam
(
'root'
))
in
captured
.
out
.
splitlines
()
assert
repr
(
grp
.
getgrnam
(
'nogroup'
))
in
captured
.
out
.
splitlines
()
assert
repr
(
grp
.
getgrgid
(
os
.
getgid
()))
in
captured
.
out
.
splitlines
()
# verify that inside environment, that nxdtest creates, file permissions are
# verify that inside environment, that nxdtest creates, file permissions are
# still respected.
# still respected.
def
test_run_writero
(
run_nxdtest
,
capsys
):
def
test_run_writero
(
run_nxdtest
,
capsys
):
...
...
nxdtest/testprog/tdumpusergroups
0 → 100755
View file @
94dd2c20
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Nexedi SA and Contributors.
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""Program tdumpusergroups helps to verify that nxdtest maps users and groups
in namespace."""
from
__future__
import
absolute_import
,
print_function
import
grp
import
pwd
import
sys
def
main
():
for
u
in
sorted
(
pwd
.
getpwall
()):
print
(
repr
(
u
))
for
g
in
sorted
(
grp
.
getgrall
()):
print
(
repr
(
g
))
if
__name__
==
'__main__'
:
main
()
Jérome Perrin
@jerome
mentioned in merge request
nexedi/nxdtest!13 (merged)
·
Dec 10, 2021
mentioned in merge request
nexedi/nxdtest!13 (merged)
mentioned in merge request nexedi/nxdtest!13
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment