Skip to content

Commit

Permalink
Fix Cassandra Archive Integration Test
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Nov 9, 2024
1 parent 7d65eb8 commit c385416
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions plugin/storage/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import (

type CassandraStorageIntegration struct {
StorageIntegration
factory *cassandra.Factory
factory *cassandra.Factory
archiveFactory *cassandra.Factory
}

func newCassandraStorageIntegration() *CassandraStorageIntegration {
Expand All @@ -38,11 +39,15 @@ func newCassandraStorageIntegration() *CassandraStorageIntegration {

func (s *CassandraStorageIntegration) cleanUp(t *testing.T) {
require.NoError(t, s.factory.Purge(context.Background()))
require.NoError(t, s.archiveFactory.Purge(context.Background()))
}

func (*CassandraStorageIntegration) initializeCassandraFactory(t *testing.T, flags []string) *cassandra.Factory {
func (*CassandraStorageIntegration) initializeCassandraFactory(
t *testing.T,
flags []string,
isArchive bool) *cassandra.Factory {
logger := zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller()))
f := cassandra.NewFactory(false)
f := cassandra.NewFactory(isArchive)
v, command := config.Viperize(f.AddFlags)
require.NoError(t, command.ParseFlags(flags))
f.InitFromViper(v, logger)
Expand All @@ -58,13 +63,26 @@ func (s *CassandraStorageIntegration) initializeCassandra(t *testing.T) {
"--cassandra.password=" + password,
"--cassandra.username=" + username,
"--cassandra.keyspace=jaeger_v1_dc1",
})
}, false)
af := s.initializeCassandraFactory(t, []string{
"--cassandra-archive.keyspace=jaeger_v1_dc1_archive",
"--cassandra-archive.enabled=true",
"--cassandra-archive.servers=127.0.0.1",
"--cassandra-archive.basic.allowed-authenticators=org.apache.cassandra.auth.PasswordAuthenticator",
"--cassandra-archive.password=" + password,
"--cassandra-archive.username=" + username,
}, true)
s.factory = f
s.archiveFactory = af
var err error
s.SpanWriter, err = f.CreateSpanWriter()
require.NoError(t, err)
s.SpanReader, err = f.CreateSpanReader()
require.NoError(t, err)
s.ArchiveSpanReader, err = af.CreateSpanReader()
require.NoError(t, err)
s.ArchiveSpanWriter, err = af.CreateSpanWriter()
require.NoError(t, err)
s.SamplingStore, err = f.CreateSamplingStore(0)
require.NoError(t, err)
s.initializeDependencyReaderAndWriter(t, f)
Expand Down

0 comments on commit c385416

Please sign in to comment.