Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
94616418
Commit
94616418
authored
6 years ago
by
Jeff Mitchell
Browse files
Options
Download
Email Patches
Plain Diff
Update vendoring
parent
8e992d7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
vendor/github.com/hashicorp/vault/api/secret.go
+1
-0
vendor/github.com/hashicorp/vault/api/secret.go
vendor/github.com/hashicorp/vault/sdk/physical/error.go
+5
-0
vendor/github.com/hashicorp/vault/sdk/physical/error.go
vendor/github.com/hashicorp/vault/sdk/physical/latency.go
+5
-0
vendor/github.com/hashicorp/vault/sdk/physical/latency.go
with
11 additions
and
0 deletions
+11
-0
vendor/github.com/hashicorp/vault/api/secret.go
+
1
-
0
View file @
94616418
...
...
@@ -293,6 +293,7 @@ type SecretAuth struct {
IdentityPolicies
[]
string
`json:"identity_policies"`
Metadata
map
[
string
]
string
`json:"metadata"`
Orphan
bool
`json:"orphan"`
EntityID
string
`json:"entity_id"`
LeaseDuration
int
`json:"lease_duration"`
Renewable
bool
`json:"renewable"`
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/hashicorp/vault/sdk/physical/error.go
+
5
-
0
View file @
94616418
...
...
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"math/rand"
"sync"
"time"
log
"github.com/hashicorp/go-hclog"
...
...
@@ -18,6 +19,7 @@ const (
type
ErrorInjector
struct
{
backend
Backend
errorPercent
int
randomLock
*
sync
.
Mutex
random
*
rand
.
Rand
}
...
...
@@ -42,6 +44,7 @@ func NewErrorInjector(b Backend, errorPercent int, logger log.Logger) *ErrorInje
return
&
ErrorInjector
{
backend
:
b
,
errorPercent
:
errorPercent
,
randomLock
:
new
(
sync
.
Mutex
),
random
:
rand
.
New
(
rand
.
NewSource
(
int64
(
time
.
Now
()
.
Nanosecond
()))),
}
}
...
...
@@ -59,7 +62,9 @@ func (e *ErrorInjector) SetErrorPercentage(p int) {
}
func
(
e
*
ErrorInjector
)
addError
()
error
{
e
.
randomLock
.
Lock
()
roll
:=
e
.
random
.
Intn
(
100
)
e
.
randomLock
.
Unlock
()
if
roll
<
e
.
errorPercent
{
return
errors
.
New
(
"random error"
)
}
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/hashicorp/vault/sdk/physical/latency.go
+
5
-
0
View file @
94616418
...
...
@@ -3,6 +3,7 @@ package physical
import
(
"context"
"math/rand"
"sync"
"time"
log
"github.com/hashicorp/go-hclog"
...
...
@@ -19,6 +20,7 @@ type LatencyInjector struct {
backend
Backend
latency
time
.
Duration
jitterPercent
int
randomLock
*
sync
.
Mutex
random
*
rand
.
Rand
}
...
...
@@ -45,6 +47,7 @@ func NewLatencyInjector(b Backend, latency time.Duration, jitter int, logger log
backend
:
b
,
latency
:
latency
,
jitterPercent
:
jitter
,
randomLock
:
new
(
sync
.
Mutex
),
random
:
rand
.
New
(
rand
.
NewSource
(
int64
(
time
.
Now
()
.
Nanosecond
()))),
}
}
...
...
@@ -68,7 +71,9 @@ func (l *LatencyInjector) addLatency() {
if
l
.
jitterPercent
>
0
{
min
:=
100
-
l
.
jitterPercent
max
:=
100
+
l
.
jitterPercent
l
.
randomLock
.
Lock
()
percent
=
l
.
random
.
Intn
(
max
-
min
)
+
min
l
.
randomLock
.
Unlock
()
}
latencyDuration
:=
time
.
Duration
(
int
(
l
.
latency
)
*
percent
/
100
)
time
.
Sleep
(
latencyDuration
)
...
...
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