Skip to content

Commit 4e12c30

Browse files
JAORMXclaude
andcommitted
Fix incorrect string conversion in test session ID generation
- Replace string(rune('a' + i)) with fmt.Sprintf("session-%d", i) - Previous approach only worked for i values 0-25 and produced unexpected Unicode characters for larger values - Add fmt import to storage_test.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 30db7d3 commit 4e12c30

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/transport/session/storage_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package session
22

33
import (
44
"context"
5+
"fmt"
56
"testing"
67
"time"
78

@@ -209,7 +210,7 @@ func TestLocalStorage(t *testing.T) {
209210

210211
// Add sessions
211212
for i := 0; i < 5; i++ {
212-
session := NewProxySession(string(rune('a' + i)))
213+
session := NewProxySession(fmt.Sprintf("session-%d", i))
213214
err := storage.Store(ctx, session)
214215
require.NoError(t, err)
215216
}
@@ -218,7 +219,7 @@ func TestLocalStorage(t *testing.T) {
218219
assert.Equal(t, 5, storage.Count())
219220

220221
// Delete one
221-
err := storage.Delete(ctx, "a")
222+
err := storage.Delete(ctx, "session-0")
222223
require.NoError(t, err)
223224

224225
// Should have 4 sessions
@@ -264,7 +265,7 @@ func TestLocalStorage(t *testing.T) {
264265

265266
// Add some sessions
266267
for i := 0; i < 3; i++ {
267-
session := NewProxySession(string(rune('x' + i)))
268+
session := NewProxySession(fmt.Sprintf("session-%d", i))
268269
err := storage.Store(ctx, session)
269270
require.NoError(t, err)
270271
}
@@ -393,7 +394,7 @@ func TestManagerWithStorage(t *testing.T) {
393394

394395
// Add sessions
395396
for i := 0; i < 3; i++ {
396-
err := manager.AddWithID(string(rune('a' + i)))
397+
err := manager.AddWithID(fmt.Sprintf("session-%d", i))
397398
require.NoError(t, err)
398399
}
399400

0 commit comments

Comments
 (0)