Update primary error functions to take a context, deprecate old functions (#1358)
* add new error funcs which take a ctx and deprecate existing funcs * use context where available when writing error events * remove circular internal/errors pkg dep * suppress some chatty errors using errors.WithoutEvent() * convert auth oidc funcs to take context where needed to write events Co-authored-by: Jim <jlambert@hashicorp.com>
This commit is contained in:
1 parent
02ff2db66e
commit
6b78108ecf
227 files changed
+3945
-3736
No files matched your search
@@ -131,6 +131,7 @@ func TestSession_Create(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
got, err := New(tt.args.composedOf)
|
||||
if tt.wantErr {
|
||||
@@ -144,10 +145,10 @@ func TestSession_Create(t *testing.T) {
|
||||
id, err := db.NewPublicId(SessionPrefix)
|
||||
require.NoError(err)
|
||||
got.PublicId = id
|
||||
_, certBytes, err := newCert(wrapper, got.UserId, id, composedOf.ExpirationTime.Timestamp.AsTime())
|
||||
_, certBytes, err := newCert(ctx, wrapper, got.UserId, id, composedOf.ExpirationTime.Timestamp.AsTime())
|
||||
require.NoError(err)
|
||||
got.Certificate = certBytes
|
||||
err = db.New(conn).Create(context.Background(), got)
|
||||
err = db.New(conn).Create(ctx, got)
|
||||
if tt.wantCreateErr {
|
||||
assert.Error(err)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user