Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nmvetcli-mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
Sysadmin
Archived
nmvetcli-mirror
Commits
cef9025b
Commit
cef9025b
authored
9 years ago
by
Christoph Hellwig
Browse files
Options
Downloads
Patches
Plain Diff
tests: check for invalid subsystem names
Signed-off-by:
Christoph Hellwig
<
hch@lst.de
>
parent
817f0b60
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
nvmet/test_nvmet.py
+21
-0
21 additions, 0 deletions
nvmet/test_nvmet.py
with
21 additions
and
0 deletions
nvmet/test_nvmet.py
+
21
−
0
View file @
cef9025b
import
random
import
string
import
unittest
import
unittest
import
nvmet.nvme
as
nvme
import
nvmet.nvme
as
nvme
...
@@ -146,6 +148,25 @@ class TestNvmet(unittest.TestCase):
...
@@ -146,6 +148,25 @@ class TestNvmet(unittest.TestCase):
s
.
delete
()
s
.
delete
()
self
.
assertEqual
(
len
(
list
(
root
.
subsystems
)),
0
)
self
.
assertEqual
(
len
(
list
(
root
.
subsystems
)),
0
)
def
test_invalid_input
(
self
):
root
=
nvme
.
Root
()
root
.
clear_existing
()
self
.
assertRaises
(
nvme
.
CFSError
,
nvme
.
Subsystem
,
nqn
=
''
,
mode
=
'
create
'
)
self
.
assertRaises
(
nvme
.
CFSError
,
nvme
.
Subsystem
,
nqn
=
'
/
'
,
mode
=
'
create
'
)
for
l
in
[
257
,
512
,
1024
,
2048
]:
toolong
=
''
.
join
(
random
.
choice
(
string
.
lowercase
)
for
i
in
range
(
l
))
self
.
assertRaises
(
nvme
.
CFSError
,
nvme
.
Subsystem
,
nqn
=
toolong
,
mode
=
'
create
'
)
discover_nqn
=
"
nqn.2014-08.org.nvmexpress.discovery
"
self
.
assertRaises
(
nvme
.
CFSError
,
nvme
.
Subsystem
,
nqn
=
discover_nqn
,
mode
=
'
create
'
)
def
test_save_restore
(
self
):
def
test_save_restore
(
self
):
root
=
nvme
.
Root
()
root
=
nvme
.
Root
()
root
.
clear_existing
()
root
.
clear_existing
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment