Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jul 19, 2024
1 parent 6e4b20d commit bca996c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions proxy/pkg/zdmproxy/streamidmapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ package zdmproxy

import (
"github.com/datastax/go-cassandra-native-protocol/primitive"
"github.com/datastax/zdm-proxy/proxy/pkg/config"
"github.com/stretchr/testify/require"
"sync"
"testing"
)

func TestStreamIdMapper(t *testing.T) {
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, 2048, nil)
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, &config.Config{ProxyMaxStreamIds: 2048}, nil)
var syntheticId, _ = mapper.GetNewIdFor(1000)
var originalId, _ = mapper.ReleaseId(syntheticId)
require.Equal(t, int16(1000), originalId)
}

func BenchmarkStreamIdMapper(b *testing.B) {
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, 2048, nil)
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, &config.Config{ProxyMaxStreamIds: 2048}, nil)
for i := 0; i < b.N; i++ {
var originalId = int16(i)
var syntheticId, _ = mapper.GetNewIdFor(originalId)
Expand All @@ -29,7 +30,7 @@ func TestConcurrentStreamIdMapper(t *testing.T) {
var wg = sync.WaitGroup{}
wg.Add(concurrency)
for i := 0; i < concurrency; i++ {
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, 2048, nil)
var mapper = NewStreamIdMapper(primitive.ProtocolVersion3, &config.Config{ProxyMaxStreamIds: 2048}, nil)
getAndReleaseIds(t, mapper, int16(i), requestCount, &wg)
}
wg.Wait()
Expand Down

0 comments on commit bca996c

Please sign in to comment.