28 lines
805 B
Go
28 lines
805 B
Go
//go:build integration
|
|
|
|
package redisactivity
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"proxy-pool/internal/domain/workerruntime/contracttest"
|
|
)
|
|
|
|
func TestRedisWorkerControlStoreContract(t *testing.T) {
|
|
contracttest.Run(t, func(*testing.T) contracttest.Fixture {
|
|
fixture := newRedisTestFixture(t)
|
|
now := redisTestNow()
|
|
seedRedisAvailable(t, fixture.Adapter, "provider-a", now, now.Add(time.Second), 2*time.Minute,
|
|
testProxy("proxy-a", "192.0.2.10"))
|
|
if _, err := fixture.Adapter.Assign(context.Background(), now.Add(2*time.Second), "proxy-a", "worker-a", time.Minute); err != nil {
|
|
t.Fatalf("Assign(): %v", err)
|
|
}
|
|
return contracttest.Fixture{
|
|
Store: fixture.Adapter, Reader: fixture.Adapter, Outcomes: fixture.Adapter, TTL: 100 * time.Millisecond,
|
|
Advance: time.Sleep,
|
|
}
|
|
})
|
|
}
|