Skip to content

Commit

Permalink
Move NewTestBuildContext to live with BuildContext
Browse files Browse the repository at this point in the history
  • Loading branch information
camdencheek committed Jun 19, 2020
1 parent ff38ac9 commit f74e942
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
12 changes: 12 additions & 0 deletions plugin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"encoding/json"
"fmt"
"reflect"
"testing"

"github.com/bluemedora/bplogagent/internal/testutil"
"go.etcd.io/bbolt"
"go.uber.org/zap"
"go.uber.org/zap/zaptest"
)

// Config is the configuration of a plugin
Expand All @@ -29,6 +32,15 @@ type BuildContext struct {
Logger *zap.SugaredLogger
}

// NewTestBuildContext returns a build context with a temporary database
// and a logger that writes to the test
func NewTestBuildContext(t *testing.T) BuildContext {
return BuildContext{
Database: testutil.NewTestDatabase(t),
Logger: zaptest.NewLogger(t).Sugar(),
}
}

// registry is a global registry of plugin types to plugin builders.
var registry = make(map[string]func() Builder)

Expand Down
15 changes: 0 additions & 15 deletions plugin/testutil.go

This file was deleted.

0 comments on commit f74e942

Please sign in to comment.