atenet/router: adapt parking tests to upstream's ActorRef addressing

Upstream now addresses actors with resources.ActorRef (2dc1fc62) and
formats client-facing error bodies as 'actor <atespace>/<name> ...'
(f83b65d1). Update the parking tests' ResumeActor call sites and
expected message strings accordingly.
This commit is contained in:
Omer Yahud
2026-07-28 23:55:51 -07:00
committed by Bowei Du
parent 0a2d87efe8
commit 6fc3467ac5
2 changed files with 15 additions and 13 deletions
+5 -5
View File
@@ -120,31 +120,31 @@ func TestMapResumeError(t *testing.T) {
name: "Aborted maps to 503 and preserves desc",
err: status.Error(codes.Aborted, "another operation is in progress for this actor"),
wantCode: envoy_type.StatusCode_ServiceUnavailable,
wantBody: `actor "ctr6" unavailable: another operation is in progress for this actor`,
wantBody: `actor team-a/ctr6 unavailable: another operation is in progress for this actor`,
},
{
name: "budget exhausted on Aborted-only maps to 503, not 500",
err: &budgetExhaustedError{lastErr: status.Error(codes.Aborted, "concurrent update conflict, please retry")},
wantCode: envoy_type.StatusCode_ServiceUnavailable,
wantBody: `actor "ctr6" unavailable: concurrent update conflict, please retry`,
wantBody: `actor team-a/ctr6 unavailable: concurrent update conflict, please retry`,
},
{
name: "budget exhausted on capacity keeps a clean body through the wrapper",
err: &budgetExhaustedError{lastErr: status.Error(codes.FailedPrecondition, "no free workers available")},
wantCode: envoy_type.StatusCode_ServiceUnavailable,
wantBody: `actor "ctr6" unavailable: no free workers available`,
wantBody: `actor team-a/ctr6 unavailable: no free workers available`,
},
{
name: "bare context.Canceled maps to 408 client-gone, not 500",
err: context.Canceled,
wantCode: envoy_type.StatusCode_RequestTimeout,
wantBody: `request for actor "ctr6" canceled by client`,
wantBody: `request for actor team-a/ctr6 canceled by client`,
},
{
name: "bare context.DeadlineExceeded maps to 504, not 500",
err: context.DeadlineExceeded,
wantCode: envoy_type.StatusCode_GatewayTimeout,
wantBody: `actor "ctr6" request timed out`,
wantBody: `actor team-a/ctr6 request timed out`,
},
{
name: "PermissionDenied maps to 403",
+10 -8
View File
@@ -177,6 +177,7 @@ func TestActorResumer_Parking(t *testing.T) {
const testActorName = "actor-park"
const testAtespace = "team-a"
const expectedIP = "10.0.0.77"
testActorRef := resources.ActorRef{Atespace: testAtespace, Name: testActorName}
t.Run("ParksThenSucceedsOnCapacityError", func(t *testing.T) {
var mu sync.Mutex
@@ -198,7 +199,7 @@ func TestActorResumer_Parking(t *testing.T) {
}
resumer := NewActorResumer(mock, withParking(ParkedRequestConfig{Max: 1, Budget: 5 * time.Second}))
actor, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
actor, err := resumer.ResumeActor(context.Background(), testActorRef)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -227,7 +228,7 @@ func TestActorResumer_Parking(t *testing.T) {
// Budget large enough for a few ~100ms-spaced retries before it elapses;
// the pool never frees up.
resumer := NewActorResumer(mock, withParking(ParkedRequestConfig{Max: 1, Budget: 1500 * time.Millisecond}))
_, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
_, err := resumer.ResumeActor(context.Background(), testActorRef)
// The client must see the meaningful capacity error, not a generic
// timeout: status.Code must unwrap through the budget-exhaustion marker.
if got := status.Code(err); got != codes.FailedPrecondition {
@@ -264,7 +265,7 @@ func TestActorResumer_Parking(t *testing.T) {
}
resumer := NewActorResumer(mock, withParking(ParkedRequestConfig{Max: 1, Budget: 5 * time.Second}))
actor, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
actor, err := resumer.ResumeActor(context.Background(), testActorRef)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
@@ -291,7 +292,7 @@ func TestActorResumer_Parking(t *testing.T) {
}
resumer := NewActorResumer(mock)
_, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
_, err := resumer.ResumeActor(context.Background(), testActorRef)
if got := status.Code(err); got != codes.Unavailable {
t.Errorf("expected Unavailable, got %v (err=%v)", got, err)
}
@@ -326,7 +327,7 @@ func TestActorResumer_Parking(t *testing.T) {
}
resumer := NewActorResumer(mock, withParking(ParkedRequestConfig{Max: 1, Budget: 300 * time.Millisecond}))
_, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
_, err := resumer.ResumeActor(context.Background(), testActorRef)
// The deadline landed mid-RPC; the client must still see the capacity
// error (503 "no free workers available"), not a generic timeout (504).
if got := status.Code(err); got != codes.FailedPrecondition {
@@ -352,7 +353,7 @@ func TestActorResumer_Parking(t *testing.T) {
// Default constructor => parking disabled => fail-fast.
resumer := NewActorResumer(mock)
_, err := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
_, err := resumer.ResumeActor(context.Background(), testActorRef)
if got := status.Code(err); got != codes.FailedPrecondition {
t.Errorf("expected FailedPrecondition, got %v (err=%v)", got, err)
}
@@ -373,6 +374,7 @@ func TestActorResumer_CallerCancelDoesNotAbortFlight(t *testing.T) {
const testActorName = "actor-cancel"
const testAtespace = "team-a"
const expectedIP = "10.0.0.88"
testActorRef := resources.ActorRef{Atespace: testAtespace, Name: testActorName}
var mu sync.Mutex
var calls int
@@ -401,7 +403,7 @@ func TestActorResumer_CallerCancelDoesNotAbortFlight(t *testing.T) {
ctx1, cancel := context.WithCancel(context.Background())
errCh := make(chan error, 1)
go func() {
_, err := resumer.ResumeActor(ctx1, testAtespace, testActorName)
_, err := resumer.ResumeActor(ctx1, testActorRef)
errCh <- err
}()
<-started
@@ -423,7 +425,7 @@ func TestActorResumer_CallerCancelDoesNotAbortFlight(t *testing.T) {
}
resCh := make(chan result, 1)
go func() {
a, rerr := resumer.ResumeActor(context.Background(), testAtespace, testActorName)
a, rerr := resumer.ResumeActor(context.Background(), testActorRef)
resCh <- result{a, rerr}
}()
// Give caller 2 a moment to join before releasing the flight, so the