Expose rqlite db handle for tests
This commit is contained in:
1 parent
bd8a1b2de4
commit
71997dc438
1 file changed
+7
@@ -42,6 +42,7 @@ type Service struct {
|
||||
|
||||
// initialized in Run
|
||||
locatorConfig *assembly.Config
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func New(boot *bootstrap.Bootstrap) (*Service, error) {
|
||||
@@ -129,6 +130,7 @@ func (s *Service) Run(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "dial to embedded rqlite")
|
||||
}
|
||||
s.db = db
|
||||
|
||||
cfg := assembly.LocalConfig{
|
||||
Local: s.cfg,
|
||||
@@ -209,6 +211,11 @@ func (s *Service) Closers() []app.Closer {
|
||||
}
|
||||
}
|
||||
|
||||
// nolint:ireturn
|
||||
func (s *Service) Db() db.DB {
|
||||
return s.db
|
||||
}
|
||||
|
||||
func (s *Service) leaderStartup(ctx context.Context) error {
|
||||
db, err := s.rqlite.SqlDB()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user