Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for failures in badger integration tests #2660

Merged
merged 1 commit into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/memory-badger-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Integration Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
memory-badger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Run in-memory and badger integration tests
run: make mem-and-badger-storage-integration-test
22 changes: 7 additions & 15 deletions plugin/storage/integration/badgerstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package integration

import (
"fmt"
"io"
"os"
"testing"

Expand All @@ -30,22 +28,23 @@ import (

type BadgerIntegrationStorage struct {
StorageIntegration
logger *zap.Logger
logger *zap.Logger
factory *badger.Factory
}

func (s *BadgerIntegrationStorage) initialize() error {
f := badger.NewFactory()
s.factory = badger.NewFactory()

err := f.Initialize(metrics.NullFactory, zap.NewNop())
err := s.factory.Initialize(metrics.NullFactory, zap.NewNop())
if err != nil {
return err
}

sw, err := f.CreateSpanWriter()
sw, err := s.factory.CreateSpanWriter()
if err != nil {
return err
}
sr, err := f.CreateSpanReader()
sr, err := s.factory.CreateSpanReader()
if err != nil {
return err
}
Expand All @@ -65,14 +64,7 @@ func (s *BadgerIntegrationStorage) initialize() error {
}

func (s *BadgerIntegrationStorage) clear() error {
if closer, ok := s.SpanWriter.(io.Closer); ok {
err := closer.Close()
if err != nil {
return err
}
return nil
}
return fmt.Errorf("BadgerIntegrationStorage did not implement io.Closer, unable to close and cleanup the storage correctly")
return s.factory.Close()
}

func (s *BadgerIntegrationStorage) cleanUp() error {
Expand Down