Well.. that escalated quickly.

Completely forgot that Traefik uses outdated Yaegi and requires compatibility with 1.20 ( pre-generic Go code ).
This commit is contained in:
2025-06-20 19:23:50 +01:00
parent 70443f0855
commit 667b4213fe
24 changed files with 439 additions and 374 deletions
+11 -6
View File
@@ -7,7 +7,6 @@ import (
"encoding/base64"
"fmt"
"net/http/httptest"
"slices"
"strings"
"sync"
"testing"
@@ -251,8 +250,8 @@ func TestChunkReassemblyEdgeCases(t *testing.T) {
corruption: func(chunks map[int]*sessions.Session) {
// This test simulates having too many chunks (>50 limit)
// We'll create a scenario by adding many fake chunks
for i := range 60 {
fakeSession := &sessions.Session{Values: make(map[any]any)}
for i := 0; i < 60; i++ {
fakeSession := &sessions.Session{Values: make(map[interface{}]interface{})}
fakeSession.Values["token_chunk"] = "fake_chunk_data"
chunks[i] = fakeSession
}
@@ -321,12 +320,12 @@ func TestRaceConditionProtection(t *testing.T) {
var wg sync.WaitGroup
errChan := make(chan error, numGoroutines*numOperations)
for i := range numGoroutines {
for i := 0; i < numGoroutines; i++ {
wg.Add(1)
go func(goroutineID int) {
defer wg.Done()
for j := range numOperations {
for j := 0; j < numOperations; j++ {
tokenIndex := (goroutineID + j) % len(tokens)
expectedToken := tokens[tokenIndex]
@@ -345,7 +344,13 @@ func TestRaceConditionProtection(t *testing.T) {
// The retrieved token should be one of the valid tokens we set
// (due to concurrent access, it might not be the exact one we just set)
isValidToken := slices.Contains(tokens, retrieved)
isValidToken := false
for _, validToken := range tokens {
if retrieved == validToken {
isValidToken = true
break
}
}
if retrieved != "" && !isValidToken {
errChan <- fmt.Errorf("goroutine %d, op %d: retrieved unknown token: %q",