Fix style
This commit is contained in:
parent
dac5b0b7f8
commit
8f06f2db4e
2 changed files with 12 additions and 12 deletions
|
@ -9,14 +9,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ error = (*ApiError)(nil)
|
_ error = (*APIError)(nil)
|
||||||
_ error = (*ConflictError)(nil)
|
_ error = (*ConflictError)(nil)
|
||||||
_ error = (*AuthError)(nil)
|
_ error = (*AuthError)(nil)
|
||||||
_ error = (*NotFoundError)(nil)
|
_ error = (*NotFoundError)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ApiError struct {
|
APIError struct {
|
||||||
Method string
|
Method string
|
||||||
|
|
||||||
Err error
|
Err error
|
||||||
|
@ -35,11 +35,11 @@ type (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *ApiError) Error() string {
|
func (a *APIError) Error() string {
|
||||||
return fmt.Sprintf("api: %q error: %v", a.Method, a.Err)
|
return fmt.Sprintf("api: %q error: %v", a.Method, a.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ApiError) Unwrap() error {
|
func (a *APIError) Unwrap() error {
|
||||||
return a.Err
|
return a.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ var (
|
||||||
|
|
||||||
errUpdate = errors.New("update error")
|
errUpdate = errors.New("update error")
|
||||||
|
|
||||||
errGetAuth = &kvapi.ApiError{Method: "get", Err: &kvapi.AuthError{Msg: "token expired"}}
|
errGetAuth = &kvapi.APIError{Method: "get", Err: &kvapi.AuthError{Msg: "token expired"}}
|
||||||
errSetAuth = &kvapi.ApiError{Method: "set", Err: &kvapi.AuthError{Msg: "token expired"}}
|
errSetAuth = &kvapi.APIError{Method: "set", Err: &kvapi.AuthError{Msg: "token expired"}}
|
||||||
|
|
||||||
errGetNoKey = &kvapi.ApiError{Method: "get", Err: &kvapi.NotFoundError{Key: K0}}
|
errGetNoKey = &kvapi.APIError{Method: "get", Err: &kvapi.NotFoundError{Key: K0}}
|
||||||
errSetNoKey = &kvapi.ApiError{Method: "set", Err: &kvapi.NotFoundError{Key: K0}}
|
errSetNoKey = &kvapi.APIError{Method: "set", Err: &kvapi.NotFoundError{Key: K0}}
|
||||||
|
|
||||||
errGetTemporary = &kvapi.ApiError{Method: "get", Err: errors.New("unavailable")}
|
errGetTemporary = &kvapi.APIError{Method: "get", Err: errors.New("unavailable")}
|
||||||
errSetTemporary = &kvapi.ApiError{Method: "set", Err: errors.New("unavailable")}
|
errSetTemporary = &kvapi.APIError{Method: "set", Err: errors.New("unavailable")}
|
||||||
)
|
)
|
||||||
|
|
||||||
type setMatcher struct {
|
type setMatcher struct {
|
||||||
|
@ -262,7 +262,7 @@ func TestRetrySetConflict(t *testing.T) {
|
||||||
|
|
||||||
c.EXPECT().
|
c.EXPECT().
|
||||||
Set(SetRequest(K0, V1, UUID0)).
|
Set(SetRequest(K0, V1, UUID0)).
|
||||||
Return(nil, &kvapi.ApiError{Method: "set", Err: &kvapi.ConflictError{ExpectedVersion: UUID1, ProvidedVersion: UUID0}}),
|
Return(nil, &kvapi.APIError{Method: "set", Err: &kvapi.ConflictError{ExpectedVersion: UUID1, ProvidedVersion: UUID0}}),
|
||||||
|
|
||||||
c.EXPECT().
|
c.EXPECT().
|
||||||
Get(&kvapi.GetRequest{Key: K0}).
|
Get(&kvapi.GetRequest{Key: K0}).
|
||||||
|
@ -296,7 +296,7 @@ func TestRetrySetFalseConflict(t *testing.T) {
|
||||||
// second Set returns conflict with ExpectedVersion == OldVersion from previous request.
|
// second Set returns conflict with ExpectedVersion == OldVersion from previous request.
|
||||||
c.EXPECT().
|
c.EXPECT().
|
||||||
Set(SetRequest(K0, V1, UUID0)).
|
Set(SetRequest(K0, V1, UUID0)).
|
||||||
Return(nil, &kvapi.ApiError{Method: "set", Err: conflictErr}),
|
Return(nil, &kvapi.APIError{Method: "set", Err: conflictErr}),
|
||||||
)
|
)
|
||||||
|
|
||||||
require.NoError(t, retryupdate.UpdateValue(c, K0, updateFn))
|
require.NoError(t, retryupdate.UpdateValue(c, K0, updateFn))
|
||||||
|
|
Loading…
Reference in a new issue