refact(session): Add context to session factory

This adds a context to the session.RepositoryFactory, allowing
errors.NewDeprecated to be replaced with errors.New. It also removes the
common.SessionRepoFactory, instead packages just directly import from
the session package.
This commit is contained in:
Timothy Messier committed 2022-09-07 17:53:40 +00:00
1 parent febf0b9984
commit eb61ac6304
25 files changed
+86 -70

No files matched your search

@@ -25,7 +25,6 @@ type (
StaticRepoFactory func() (*static.Repository, error)
PluginHostRepoFactory func() (*pluginhost.Repository, error)
HostPluginRepoFactory func() (*hostplugin.Repository, error)
SessionRepoFactory session.RepositoryFactory // TODO refactor and remove this
ConnectionRepoFactory func() (*session.ConnectionRepository, error)
TargetRepoFactory func() (*target.Repository, error)
WorkerAuthRepoStorageFactory func() (*server.WorkerAuthRepositoryStorage, error)
@@ -44,8 +44,9 @@ func TestListingScopeIds(t *testing.T) {
s, err := groups.NewService(iamRepoFn)
require.NoError(t, err)
ctx := context.Background()
sessionsRepoFn := func(opt ...session.Option) (*session.Repository, error) {
return session.NewRepository(rw, rw, kms, opt...)
return session.NewRepository(ctx, rw, rw, kms, opt...)
}
sess, err := sessions.NewService(sessionsRepoFn, iamRepoFn)
require.NoError(t, err)