Record project continuation changes

This commit is contained in:
2026-05-12 21:02:29 +03:00
parent 3059d1d7a3
commit 8f69d53193
339 changed files with 101111 additions and 1769 deletions
@@ -33,3 +33,101 @@ func TestStubSupervisorReportsStoppedForDisabledWorkload(t *testing.T) {
t.Fatalf("ReportedState = %q", statuses[0].ReportedState)
}
}
func TestStubSupervisorRunsInternalSyntheticEchoWorkload(t *testing.T) {
statuses, err := (StubSupervisor{Version: "test"}).Apply(context.Background(), []client.DesiredWorkload{
{ServiceType: "synthetic.echo", DesiredState: "enabled", RuntimeMode: "native"},
})
if err != nil {
t.Fatalf("apply desired workload: %v", err)
}
if statuses[0].ReportedState != "running" {
t.Fatalf("ReportedState = %q", statuses[0].ReportedState)
}
if statuses[0].StatusPayload["reason"] != "internal_synthetic_echo_ready" {
t.Fatalf("reason = %v", statuses[0].StatusPayload["reason"])
}
if statuses[0].StatusPayload["execution_mode"] != "builtin" {
t.Fatalf("execution_mode = %v", statuses[0].StatusPayload["execution_mode"])
}
}
func TestStubSupervisorReportsBuiltinFabricServicesRunning(t *testing.T) {
statuses, err := (StubSupervisor{Version: "test"}).Apply(context.Background(), []client.DesiredWorkload{
{ServiceType: "core-mesh", DesiredState: "enabled", RuntimeMode: "container"},
{ServiceType: "mesh-listener", DesiredState: "enabled", RuntimeMode: "container"},
})
if err != nil {
t.Fatalf("apply desired workload: %v", err)
}
if len(statuses) != 2 {
t.Fatalf("statuses length = %d", len(statuses))
}
for _, status := range statuses {
if status.ReportedState != "running" {
t.Fatalf("ReportedState = %q", status.ReportedState)
}
if status.StatusPayload["reason"] != "builtin_node_agent_service_ready" {
t.Fatalf("reason = %v", status.StatusPayload["reason"])
}
}
}
func TestStubSupervisorKeepsUnsupportedEnabledWorkloadDegraded(t *testing.T) {
statuses, err := (StubSupervisor{Version: "test"}).Apply(context.Background(), []client.DesiredWorkload{
{ServiceType: "rdp-worker", DesiredState: "enabled", RuntimeMode: "container"},
})
if err != nil {
t.Fatalf("apply desired workload: %v", err)
}
if statuses[0].ReportedState != "degraded" {
t.Fatalf("ReportedState = %q", statuses[0].ReportedState)
}
if statuses[0].StatusPayload["reason"] != "service_runtime_not_implemented" {
t.Fatalf("reason = %v", statuses[0].StatusPayload["reason"])
}
}
func TestStubSupervisorRunsRDPWorkerAdapterContractProbeOnly(t *testing.T) {
statuses, err := (StubSupervisor{Version: "test"}).Apply(context.Background(), []client.DesiredWorkload{
{
ServiceType: "rdp-worker",
DesiredState: "enabled",
RuntimeMode: "native",
Config: map[string]any{
"adapter_contract_probe": true,
},
},
})
if err != nil {
t.Fatalf("apply desired workload: %v", err)
}
if statuses[0].ReportedState != "running" {
t.Fatalf("ReportedState = %q", statuses[0].ReportedState)
}
if statuses[0].StatusPayload["reason"] != "remote_workspace_adapter_contract_probe_ready" {
t.Fatalf("reason = %v", statuses[0].StatusPayload["reason"])
}
if statuses[0].StatusPayload["service_class"] != "remote_workspace" {
t.Fatalf("service_class = %v", statuses[0].StatusPayload["service_class"])
}
if statuses[0].StatusPayload["backend_relay_steady_state"] != false {
t.Fatalf("backend_relay_steady_state = %v", statuses[0].StatusPayload["backend_relay_steady_state"])
}
channels, ok := statuses[0].StatusPayload["channels"].([]map[string]any)
if !ok || len(channels) != 9 {
t.Fatalf("channels = %#v", statuses[0].StatusPayload["channels"])
}
if channels[0]["name"] != "input" || channels[0]["priority"] != "critical" || channels[0]["droppable"] != true || channels[0]["may_block_input"] != false {
t.Fatalf("unexpected input channel: %#v", channels[0])
}
frameBatch, ok := statuses[0].StatusPayload["frame_batch_contract"].(map[string]any)
if !ok {
t.Fatalf("frame_batch_contract = %#v", statuses[0].StatusPayload["frame_batch_contract"])
}
if frameBatch["schema_version"] != "rap.remote_workspace_frame_batch.v1" ||
frameBatch["payload_forwarding"] != "not_implemented" ||
frameBatch["service_class"] != "remote_workspace" {
t.Fatalf("unexpected frame batch contract: %#v", frameBatch)
}
}