Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions plugin/storage/cassandra/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package cassandra

import (
"context"
"errors"
"flag"
"io"
Expand Down Expand Up @@ -251,3 +252,7 @@ func (f *Factory) Close() error {
func (f *Factory) PrimarySession() cassandra.Session {
return f.primarySession
}

func (f *Factory) Purge(_ context.Context) error {
return f.primarySession.Query("TRUNCATE traces").Exec()
}
5 changes: 4 additions & 1 deletion plugin/storage/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package integration

import (
"context"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -33,6 +34,7 @@ type CassandraStorageIntegration struct {
StorageIntegration

session dbsession.Session
factory *cassandra.Factory
}

func newCassandraStorageIntegration() *CassandraStorageIntegration {
Expand All @@ -58,7 +60,7 @@ func newCassandraStorageIntegration() *CassandraStorageIntegration {
}

func (s *CassandraStorageIntegration) cleanUp(t *testing.T) {
require.NoError(t, s.session.Query("TRUNCATE traces").Exec())
require.NoError(t, s.factory.Purge(context.Background()))
}

func (s *CassandraStorageIntegration) initializeCassandraFactory(t *testing.T, flags []string) *cassandra.Factory {
Expand All @@ -75,6 +77,7 @@ func (s *CassandraStorageIntegration) initializeCassandra(t *testing.T) {
f := s.initializeCassandraFactory(t, []string{
"--cassandra.keyspace=jaeger_v1_dc1",
})
s.factory = f
s.session = f.PrimarySession()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

session field can be deleted

var err error
s.SpanWriter, err = f.CreateSpanWriter()
Expand Down