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
48 changes: 48 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,8 @@ var implementedEffectProbes = map[string]string{
"protoTasks.maxPerRequestor": "TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment",
"protoTasks.perMinute": "TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment",
"events.history": "TestEventsHistoryBoundsTheReplay",
"artifacts.interceptImages": "TestArtifactsInterceptImagesStoresAnEmittedImage",
"plumbing.indexOnQuery": "TestPlumbingIndexOnQueryIngestsBeforeALogQuery",
"plumbing.validatePaths": "TestPlumbingValidatePathsChecksTheLogDirUpFront",
"script.language": "TestScriptLanguageRunsPython",
"logging.trace": "TestLoggingTraceLogsEachCall",
Expand Down Expand Up @@ -229,6 +231,8 @@ var effectProbeFuncs = map[string]func(*testing.T){
"TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment": TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment,
"TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment": TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment,
"TestEventsHistoryBoundsTheReplay": TestEventsHistoryBoundsTheReplay,
"TestArtifactsInterceptImagesStoresAnEmittedImage": TestArtifactsInterceptImagesStoresAnEmittedImage,
"TestPlumbingIndexOnQueryIngestsBeforeALogQuery": TestPlumbingIndexOnQueryIngestsBeforeALogQuery,
"TestPlumbingValidatePathsChecksTheLogDirUpFront": TestPlumbingValidatePathsChecksTheLogDirUpFront,
"TestScriptLanguageRunsPython": TestScriptLanguageRunsPython,
"TestLoggingTraceLogsEachCall": TestLoggingTraceLogsEachCall,
Expand Down Expand Up @@ -2380,6 +2384,50 @@ func TestScriptLanguageRunsPython(t *testing.T) {
}
}

// TestArtifactsInterceptImagesStoresAnEmittedImage is the effect probe for
// artifacts.interceptImages: an image block a script emits is captured as
// an artifact by default, and left alone once interception is off.
func TestArtifactsInterceptImagesStoresAnEmittedImage(t *testing.T) {
const script = `emit({ type: "image", data: "iVBORw0KGgo=", mimeType: "image/png" })`
run := func(env ...string) string {
e := newEnv(t, oneServer)
e.setenv(env...)
out, err := e.try("exec", "--json", script)
if err != nil {
t.Fatalf("exec: %v\n%s", err, out)
}
return out
}
if out := run(); !strings.Contains(out, `"name": "image.png"`) {
t.Errorf("by default an emitted image should become an artifact:\n%s", out)
}
if out := run("MCPX_ARTIFACTS_INTERCEPT_IMAGES=false"); strings.Contains(out, `"name": "image.png"`) {
t.Errorf("with artifacts.interceptImages off the image should not be stored:\n%s", out)
}
}

// TestPlumbingIndexOnQueryIngestsBeforeALogQuery is the effect probe for
// plumbing.indexOnQuery: `mcpx log` reads the daemon's records by default,
// and answers from the empty index alone once ingest-on-query is off.
func TestPlumbingIndexOnQueryIngestsBeforeALogQuery(t *testing.T) {
query := func(env ...string) string {
e := newEnv(t, oneServer)
e.setenv(append([]string{"MCPX_LOGGING_DIR=" + filepath.Join(t.TempDir(), "logs")}, env...)...)
e.run("ls")
out, se, err := e.split("log")
if err != nil {
t.Fatalf("log: %v\n%s", err, se)
}
return out
}
if out := query(); !strings.Contains(out, "daemon starting") {
t.Errorf("by default `mcpx log` should ingest and show the daemon's start:\n%s", out)
}
if out := query("MCPX_PLUMBING_INDEX_ON_QUERY=false"); strings.Contains(out, "daemon starting") {
t.Errorf("with plumbing.indexOnQuery off nothing should have been ingested:\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
2 changes: 0 additions & 2 deletions pkgs/mcpx/internal/e2e/feature_coverage_exemptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ setting prompt.sampleTimeout no integration-test exercise yet; burn-down #8471 (
setting artifacts.chunkBytes no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting artifacts.gcInterval no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting artifacts.idleTtl no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting artifacts.interceptImages no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting artifacts.maxAge no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting artifacts.ttl no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting autonomy.max no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
Expand All @@ -123,7 +122,6 @@ setting doctor.timeout no integration-test exercise yet; burn-down #8470 (settin
setting events.reconnect no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting hooks.autonomy no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting plumbing.allowTsJsOverlap no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting plumbing.indexOnQuery no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting plumbing.launcherPlaceholderRepeat no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting plumbing.sourceDirAllowed no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
setting plumbing.sourceDirRecursive no integration-test exercise yet; burn-down #8470 (settings long-tail families); needs an EffectProbes entry + e2e test
Expand Down
Loading