Skip to content

Commit

Permalink
Fixed open database in offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwilliams89 committed Sep 8, 2020
1 parent f8ec85c commit 98ae4cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/stanza/offsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"os"

"github.com/observiq/stanza/operator"
"github.com/observiq/stanza/database"
"github.com/observiq/stanza/operator/helper"
"github.com/spf13/cobra"
"go.etcd.io/bbolt"
Expand Down Expand Up @@ -39,7 +39,7 @@ func NewOffsetsClearCmd(rootFlags *RootFlags) *cobra.Command {
Short: "Clear persisted offsets from the database",
Args: cobra.ArbitraryArgs,
Run: func(command *cobra.Command, args []string) {
db, err := operator.OpenDatabase(rootFlags.DatabaseFile)
db, err := database.OpenDatabase(rootFlags.DatabaseFile)
exitOnErr("Failed to open database", err)
defer db.Close()
defer db.Sync()
Expand Down Expand Up @@ -90,7 +90,7 @@ func NewOffsetsListCmd(rootFlags *RootFlags) *cobra.Command {
Short: "List operators with persisted offsets",
Args: cobra.NoArgs,
Run: func(command *cobra.Command, args []string) {
db, err := operator.OpenDatabase(rootFlags.DatabaseFile)
db, err := database.OpenDatabase(rootFlags.DatabaseFile)
exitOnErr("Failed to open database", err)
defer db.Close()

Expand Down
4 changes: 2 additions & 2 deletions cmd/stanza/offsets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"testing"

agent "github.com/observiq/stanza/agent"
"github.com/observiq/stanza/database"
"github.com/observiq/stanza/operator/helper"
"github.com/stretchr/testify/require"
"go.etcd.io/bbolt"
Expand All @@ -27,7 +27,7 @@ func TestOffsets(t *testing.T) {
stdout = buf

// add an offset to the database
db, err := agent.OpenDatabase(databasePath)
db, err := database.OpenDatabase(databasePath)
require.NoError(t, err)
db.Update(func(tx *bbolt.Tx) error {
bucket, err := tx.CreateBucketIfNotExists(helper.OffsetsBucket)
Expand Down

0 comments on commit 98ae4cf

Please sign in to comment.