Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
c95fdc7d
Commit
c95fdc7d
authored
7 years ago
by
Chelsea Holland Komlo
Browse files
Options
Download
Email Patches
Plain Diff
add failure test cases
parent
2faf35c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
command/acl_bootstrap_test.go
+44
-1
command/acl_bootstrap_test.go
with
44 additions
and
1 deletion
+44
-1
command/acl_bootstrap_test.go
+
44
-
1
View file @
c95fdc7d
...
...
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
)
func
TestACLBootstrapCommand
_Implements
(
t
*
testing
.
T
)
{
func
TestACLBootstrapCommand
(
t
*
testing
.
T
)
{
t
.
Parallel
()
assert
:=
assert
.
New
(
t
)
...
...
@@ -32,3 +32,46 @@ func TestACLBootstrapCommand_Implements(t *testing.T) {
out
:=
ui
.
OutputWriter
.
String
()
assert
.
Contains
(
out
,
"Secret ID"
)
}
// If a bootsrap token has already been created, attempts to create more should
// fail.
func
TestACLBootstrapCommand_ExistingBootstrapToken
(
t
*
testing
.
T
)
{
t
.
Parallel
()
assert
:=
assert
.
New
(
t
)
config
:=
func
(
c
*
agent
.
Config
)
{
c
.
ACL
.
Enabled
=
true
}
srv
,
_
,
url
:=
testServer
(
t
,
true
,
config
)
defer
srv
.
Shutdown
()
assert
.
NotNil
(
srv
.
RootToken
)
ui
:=
new
(
cli
.
MockUi
)
cmd
:=
&
ACLBootstrapCommand
{
Meta
:
Meta
{
Ui
:
ui
,
flagAddress
:
url
}}
code
:=
cmd
.
Run
([]
string
{
"-address="
+
url
})
assert
.
Equal
(
1
,
code
)
out
:=
ui
.
OutputWriter
.
String
()
assert
.
NotContains
(
out
,
"Secret ID"
)
}
// Attempting to bootstrap a token on a non-ACL enabled server should fail.
func
TestACLBootstrapCommand_NonACLServer
(
t
*
testing
.
T
)
{
t
.
Parallel
()
assert
:=
assert
.
New
(
t
)
srv
,
_
,
url
:=
testServer
(
t
,
true
,
nil
)
defer
srv
.
Shutdown
()
ui
:=
new
(
cli
.
MockUi
)
cmd
:=
&
ACLBootstrapCommand
{
Meta
:
Meta
{
Ui
:
ui
,
flagAddress
:
url
}}
code
:=
cmd
.
Run
([]
string
{
"-address="
+
url
})
assert
.
Equal
(
1
,
code
)
out
:=
ui
.
OutputWriter
.
String
()
assert
.
NotContains
(
out
,
"Secret ID"
)
}
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