Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
4297b611
Unverified
Commit
4297b611
authored
3 years ago
by
Pratyoy Mukhopadhyay
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
add missed test (#14168)
parent
64a8f9ae
Branches unavailable
v1.10.2
v1.10.1
v1.10.0
v1.10.0-rc1
sdk/v0.4.1
sdk/v0.4.0
last-go-modable
api/v1.5.0
api/v1.4.1
api/v1.4.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vault/logical_system_test.go
+57
-0
vault/logical_system_test.go
with
57 additions
and
0 deletions
+57
-0
vault/logical_system_test.go
+
57
-
0
View file @
4297b611
...
...
@@ -875,6 +875,63 @@ func TestSystemBackend_remount(t *testing.T) {
})
}
func
TestSystemBackend_remount_destinationInUse
(
t
*
testing
.
T
)
{
c
,
b
,
_
:=
testCoreSystemBackend
(
t
)
me
:=
&
MountEntry
{
Table
:
mountTableType
,
Path
:
"foo/"
,
Type
:
"generic"
,
}
err
:=
c
.
mount
(
namespace
.
RootContext
(
nil
),
me
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %v"
,
err
)
}
req
:=
logical
.
TestRequest
(
t
,
logical
.
UpdateOperation
,
"remount"
)
req
.
Data
[
"from"
]
=
"secret"
req
.
Data
[
"to"
]
=
"foo"
req
.
Data
[
"config"
]
=
structs
.
Map
(
MountConfig
{})
resp
,
err
:=
b
.
HandleRequest
(
namespace
.
RootContext
(
nil
),
req
)
if
err
!=
logical
.
ErrInvalidRequest
{
t
.
Fatalf
(
"err: %v"
,
err
)
}
if
!
strings
.
Contains
(
resp
.
Data
[
"error"
]
.
(
string
),
"path already in use at
\"
foo/
\"
"
)
{
t
.
Fatalf
(
"Found unexpected error %q"
,
resp
.
Data
[
"error"
]
.
(
string
))
}
req
.
Data
[
"to"
]
=
"foo/foo2"
resp
,
err
=
b
.
HandleRequest
(
namespace
.
RootContext
(
nil
),
req
)
if
err
!=
logical
.
ErrInvalidRequest
{
t
.
Fatalf
(
"err: %v"
,
err
)
}
if
!
strings
.
Contains
(
resp
.
Data
[
"error"
]
.
(
string
),
"path already in use at
\"
foo/
\"
"
)
{
t
.
Fatalf
(
"Found unexpected error %q"
,
resp
.
Data
[
"error"
]
.
(
string
))
}
me2
:=
&
MountEntry
{
Table
:
mountTableType
,
Path
:
"foo2/foo3/"
,
Type
:
"generic"
,
}
err
=
c
.
mount
(
namespace
.
RootContext
(
nil
),
me2
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %v"
,
err
)
}
req
.
Data
[
"to"
]
=
"foo2/"
resp
,
err
=
b
.
HandleRequest
(
namespace
.
RootContext
(
nil
),
req
)
if
err
!=
logical
.
ErrInvalidRequest
{
t
.
Fatalf
(
"err: %v"
,
err
)
}
if
!
strings
.
Contains
(
resp
.
Data
[
"error"
]
.
(
string
),
"path already in use at
\"
foo2/foo3/
\"
"
)
{
t
.
Fatalf
(
"Found unexpected error %q"
,
resp
.
Data
[
"error"
]
.
(
string
))
}
}
func
TestSystemBackend_remount_invalid
(
t
*
testing
.
T
)
{
b
:=
testSystemBackend
(
t
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help