Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: e2e stack captures an empty pinchtab log because every service runs server without --verbose PIN-029

Luigi Agosti9f983cd9936e
diff --git a/tests/e2e/docker-compose-multi.yml b/tests/e2e/docker-compose-multi.yml
index 70bf8c21..1ca98954 100644
--- a/tests/e2e/docker-compose-multi.yml
+++ b/tests/e2e/docker-compose-multi.yml
@@ -25,7 +25,7 @@ services:
- ./config/pinchtab.json:/fixture-config/pinchtab.json:ro
- ./fixtures/test-extension:/extensions/test-extension
- ./fixtures/test-extension-api:/extensions/test-extension-api
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab.json /data/e2e-config/pinchtab.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab.json /data/e2e-config/pinchtab.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9999:9999"
healthcheck: *pinchtab-healthcheck
@@ -36,7 +36,7 @@ services:
PINCHTAB_CONFIG: /data/e2e-config/pinchtab-secure.json
volumes:
- ./config/pinchtab-secure.json:/fixture-config/pinchtab-secure.json:ro
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-secure.json /data/e2e-config/pinchtab-secure.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-secure.json /data/e2e-config/pinchtab-secure.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9998:9999"
healthcheck: *pinchtab-healthcheck
@@ -48,7 +48,7 @@ services:
volumes:
- ./config/pinchtab-autoclose.json:/fixture-config/pinchtab-autoclose.json:ro
- ./fixtures/test-extension:/extensions/test-extension
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-autoclose.json /data/e2e-config/pinchtab-autoclose.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-autoclose.json /data/e2e-config/pinchtab-autoclose.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
healthcheck: *pinchtab-healthcheck
pinchtab-medium:
@@ -58,7 +58,7 @@ services:
volumes:
- ./config/pinchtab-medium-permissive.json:/fixture-config/pinchtab-medium-permissive.json:ro
- ./fixtures/test-extension:/extensions/test-extension
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-medium-permissive.json /data/e2e-config/pinchtab-medium-permissive.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-medium-permissive.json /data/e2e-config/pinchtab-medium-permissive.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9994:9999"
healthcheck: *pinchtab-healthcheck
@@ -70,7 +70,7 @@ services:
volumes:
- ./config/pinchtab-full-permissive.json:/fixture-config/pinchtab-full-permissive.json:ro
- ./fixtures/test-extension:/extensions/test-extension
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-full-permissive.json /data/e2e-config/pinchtab-full-permissive.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-full-permissive.json /data/e2e-config/pinchtab-full-permissive.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9995:9999"
healthcheck: *pinchtab-healthcheck
@@ -82,7 +82,7 @@ services:
volumes:
- ./config/pinchtab-network-retain-bodies.json:/fixture-config/pinchtab-network-retain-bodies.json:ro
- ./fixtures/test-extension:/extensions/test-extension
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-network-retain-bodies.json /data/e2e-config/pinchtab-network-retain-bodies.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab-network-retain-bodies.json /data/e2e-config/pinchtab-network-retain-bodies.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9993:9999"
healthcheck: *pinchtab-healthcheck
diff --git a/tests/e2e/docker-compose.yml b/tests/e2e/docker-compose.yml
index 2296c89f..050881b4 100644
--- a/tests/e2e/docker-compose.yml
+++ b/tests/e2e/docker-compose.yml
@@ -9,7 +9,7 @@ services:
- ./config/pinchtab.json:/fixture-config/pinchtab.json:ro
- ./fixtures/test-extension:/extensions/test-extension:ro
- ./fixtures/test-extension-api:/extensions/test-extension-api:ro
- command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab.json /data/e2e-config/pinchtab.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server"]
+ command: ["/bin/sh", "-lc", "mkdir -p /data/e2e-config && cp /fixture-config/pinchtab.json /data/e2e-config/pinchtab.json && exec /usr/local/bin/docker-entrypoint.sh pinchtab server --verbose"]
ports:
- "127.0.0.1:9999:9999"
shm_size: '2gb'
diff --git a/tests/tools/runner/internal/e2e/e2e_test.go b/tests/tools/runner/internal/e2e/e2e_test.go
index 8f94082c..a020038c 100644
--- a/tests/tools/runner/internal/e2e/e2e_test.go
+++ b/tests/tools/runner/internal/e2e/e2e_test.go
@@ -1034,3 +1034,58 @@ func TestNewBrowserScenariosInCatalog(t *testing.T) {
}
}
}
+
+// A log artifact the runner advertises but that captured nothing sends whoever
+// is diagnosing a failure to a useless file; the listing has to say so.
+func TestEmptyLogSuffixMarksZeroByteArtifacts(t *testing.T) {
+ dir := t.TempDir()
+
+ empty := filepath.Join(dir, "logs-cli-smoke-pinchtab.log")
+ if err := os.WriteFile(empty, nil, 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if got := emptyLogSuffix(empty); got == "" {
+ t.Error("a zero-byte log artifact is listed with no warning")
+ }
+
+ populated := filepath.Join(dir, "logs-cli-smoke-runner-cli.log")
+ if err := os.WriteFile(populated, []byte("level=INFO msg=request\n"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if got := emptyLogSuffix(populated); got != "" {
+ t.Errorf("suffix = %q, want none for a log with content", got)
+ }
+
+ if got := emptyLogSuffix(filepath.Join(dir, "missing.log")); got != "" {
+ t.Errorf("suffix = %q, want none for a file that does not exist", got)
+ }
+}
+
+// The e2e services must run the server verbosely: RunDashboard swaps the default
+// logger for a discard handler otherwise, so the harness captures zero bytes for
+// exactly the failure the artifact exists to explain. Bridge mode has no such
+// swap and is deliberately left alone.
+func TestComposeServerServicesRunVerbose(t *testing.T) {
+ for _, file := range []string{"docker-compose.yml", "docker-compose-multi.yml"} {
+ path := filepath.Join("..", "..", "..", "..", "e2e", file)
+ content, err := os.ReadFile(path) // #nosec G304 -- fixed test fixture path.
+ if err != nil {
+ t.Fatalf("read %s: %v", file, err)
+ }
+
+ servers := strings.Count(string(content), "pinchtab server")
+ verbose := strings.Count(string(content), "pinchtab server --verbose")
+ if servers == 0 {
+ t.Fatalf("%s: found no pinchtab server services to check", file)
+ }
+ if verbose != servers {
+ t.Errorf("%s: %d of %d server services run verbose; the rest capture an empty log", file, verbose, servers)
+ }
+
+ for _, line := range strings.Split(string(content), "\n") {
+ if strings.Contains(line, "pinchtab bridge") && strings.Contains(line, "--verbose") {
+ t.Errorf("%s: bridge service gained --verbose; bridge mode already logs: %s", file, strings.TrimSpace(line))
+ }
+ }
+ }
+}
diff --git a/tests/tools/runner/internal/e2e/suite.go b/tests/tools/runner/internal/e2e/suite.go
index b3918eba..92a7649b 100644
--- a/tests/tools/runner/internal/e2e/suite.go
+++ b/tests/tools/runner/internal/e2e/suite.go
@@ -356,11 +356,11 @@ func (r *Runner) showFailureArtifacts(def suiteDef, duration time.Duration) {
for _, service := range def.LogServices {
path := filepath.Join("tests/e2e/results", def.LogPrefix+"-"+service+".log")
if fileExists(filepath.Join(r.repoRoot, path)) {
- _, _ = fmt.Fprintf(r.stdout, " logs: %s\n", path)
+ _, _ = fmt.Fprintf(r.stdout, " logs: %s%s\n", path, emptyLogSuffix(filepath.Join(r.repoRoot, path)))
}
}
if fileExists(filepath.Join(r.repoRoot, stackOutput)) {
- _, _ = fmt.Fprintf(r.stdout, " logs: %s\n", stackOutput)
+ _, _ = fmt.Fprintf(r.stdout, " logs: %s%s\n", stackOutput, emptyLogSuffix(filepath.Join(r.repoRoot, stackOutput)))
}
if duration > 0 {
_, _ = fmt.Fprintf(r.stdout, " duration: %s\n", formatDuration(duration))
@@ -755,6 +755,18 @@ func formatDuration(d time.Duration) string {
return fmt.Sprintf("%dm%02d.%03ds", minutes, remSec, remMs)
}
+// emptyLogSuffix marks a log artifact that has nothing in it. An empty file
+// listed as `logs:` is worse than no listing at all — it sends whoever is
+// diagnosing a failure to a file that cannot explain it — so say so on the line
+// that advertises it.
+func emptyLogSuffix(path string) string {
+ info, err := os.Stat(path)
+ if err != nil || info.Size() > 0 {
+ return ""
+ }
+ return " (EMPTY — captured nothing; the service may be discarding its logs)"
+}
+
func fileExists(path string) bool {
_, err := os.Stat(path)
return err == nil