Skip to content

Commit

Permalink
Fix for failures in badger integration tests (#2660)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashmita Bohara <ashmita.bohara152@gmail.com>
  • Loading branch information
Ashmita152 authored Nov 27, 2020
1 parent 88b27de commit fa58f28
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
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

0 comments on commit fa58f28

Please sign in to comment.