Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions pkgs/mcpx/internal/e2e/effect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ var implementedEffectProbes = map[string]string{
"protoTasks.maxPerRequestor": "TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment",
"protoTasks.perMinute": "TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment",
"events.history": "TestEventsHistoryBoundsTheReplay",
"pool.callTimeout": "TestPoolCallTimeoutBoundsASlowCall",
"pool.startTimeout": "TestPoolStartTimeoutBoundsServerStart",
"daemon.refreshTimeout": "TestDaemonRefreshTimeoutBoundsARefresh",
"doctor.timeout": "TestDoctorTimeoutBoundsTheDaemonCheck",
"registry.timeout": "TestRegistryTimeoutBoundsARegistryRequest",
"completion.maxValues": "TestCompletionMaxValuesCapsTheValues",
Expand Down Expand Up @@ -243,6 +246,9 @@ var effectProbeFuncs = map[string]func(*testing.T){
"TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment": TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment,
"TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment": TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment,
"TestEventsHistoryBoundsTheReplay": TestEventsHistoryBoundsTheReplay,
"TestPoolCallTimeoutBoundsASlowCall": TestPoolCallTimeoutBoundsASlowCall,
"TestPoolStartTimeoutBoundsServerStart": TestPoolStartTimeoutBoundsServerStart,
"TestDaemonRefreshTimeoutBoundsARefresh": TestDaemonRefreshTimeoutBoundsARefresh,
"TestDoctorTimeoutBoundsTheDaemonCheck": TestDoctorTimeoutBoundsTheDaemonCheck,
"TestRegistryTimeoutBoundsARegistryRequest": TestRegistryTimeoutBoundsARegistryRequest,
"TestCompletionMaxValuesCapsTheValues": TestCompletionMaxValuesCapsTheValues,
Expand Down Expand Up @@ -2713,6 +2719,58 @@ func TestRegistryTimeoutBoundsARegistryRequest(t *testing.T) {
}
}

// TestPoolCallTimeoutBoundsASlowCall is the effect probe for
// pool.callTimeout: a 600ms call finishes at the default bound and is cut
// off at a 100ms one.
func TestPoolCallTimeoutBoundsASlowCall(t *testing.T) {
call := func(env ...string) (string, error) {
e := newEnv(t, oneServer)
e.setenv(env...)
return e.try("call", "demo.slow", `{"ms":600}`)
}
if out, err := call(); err != nil || !strings.Contains(out, "slept 600ms") {
t.Errorf("at the default pool.callTimeout the slow call should finish (err %v):\n%s", err, out)
}
if out, err := call("MCPX_POOL_CALL_TIMEOUT=100ms"); err == nil || strings.Contains(out, "slept 600ms") {
t.Errorf("pool.callTimeout=100ms should cut the 600ms call off (err %v):\n%s", err, out)
}
}

// TestPoolStartTimeoutBoundsServerStart is the effect probe for
// pool.startTimeout: the fake server starts at the default bound, and a
// one-nanosecond bound fails its start.
func TestPoolStartTimeoutBoundsServerStart(t *testing.T) {
call := func(env ...string) (string, error) {
e := newEnv(t, oneServer)
e.setenv(env...)
return e.try("call", "demo.echo", `{"message":"started"}`)
}
if out, err := call(); err != nil || !strings.Contains(out, "started") {
t.Errorf("at the default pool.startTimeout the server should start (err %v):\n%s", err, out)
}
if out, err := call("MCPX_POOL_START_TIMEOUT=1ns"); err == nil || !strings.Contains(out, "deadline exceeded") {
t.Errorf("pool.startTimeout=1ns should fail the server's start (err %v):\n%s", err, out)
}
}

// TestDaemonRefreshTimeoutBoundsARefresh is the effect probe for
// daemon.refreshTimeout: `mcpx refresh` lists the server at the default
// bound, and a one-nanosecond bound leaves it in error.
func TestDaemonRefreshTimeoutBoundsARefresh(t *testing.T) {
refresh := func(env ...string) string {
e := newEnv(t, oneServer)
e.setenv(env...)
out, _ := e.try("refresh")
return out
}
if out := refresh(); strings.Contains(out, "deadline exceeded") || !strings.Contains(out, "running") {
t.Errorf("at the default daemon.refreshTimeout the refresh should succeed:\n%s", out)
}
if out := refresh("MCPX_DAEMON_REFRESH_TIMEOUT=1ns"); !strings.Contains(out, "deadline exceeded") {
t.Errorf("daemon.refreshTimeout=1ns should cut the refresh off:\n%s", out)
}
}

// TestDaemonAddressIsReachableFromTheEnvironment is the effect probe
// for daemon.address (#8468 chain 1). The exemption it replaced said
// a bind address is a network identity the harness cannot vary
Expand Down
3 changes: 0 additions & 3 deletions pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ setting daemon.leaseTTL no integration-test exercise yet; burn-down #8468 (setti
setting daemon.port no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.probeTimeout no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.reapInterval no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.refreshTimeout no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.roots no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.saveInterval no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
setting daemon.socketProbeTimeout no integration-test exercise yet; burn-down #8468 (settings daemon family); needs an EffectProbes entry + e2e test
Expand Down Expand Up @@ -70,10 +69,8 @@ setting logging.maxAge no integration-test exercise yet; burn-down #8467 (settin
setting logstore.followBacklog no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting output.color no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting paths.config no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting pool.callTimeout no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting pool.idleTimeout no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting pool.min no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting pool.startTimeout no integration-test exercise yet; burn-down #8467 (settings core-paths family); needs an EffectProbes entry + e2e test
setting elicit.askTimeout no integration-test exercise yet; burn-down #8471 (settings model-ai family); needs an EffectProbes entry + e2e test
setting elicit.confirmDestructive no integration-test exercise yet; burn-down #8471 (settings model-ai family); needs an EffectProbes entry + e2e test
setting elicit.disambiguate no integration-test exercise yet; burn-down #8471 (settings model-ai family); needs an EffectProbes entry + e2e test
Expand Down
Loading