test(app): isolate attachment observability environment
- commit
- babcd3a7bb4507473c2af41865b0da83cd69c281
- author
- brice · · 2026-07-24 15:17 UTC
- committer
- brice · · 2026-07-25 04:08 UTC
- parent
- dec966b
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +4 -0
M internal/app/transport_observability_test.go +4 -0
| @@ -184,11 +184,15 @@ func TestRunAttachJoinsTraceCloseError(t *testing.T) { | |||
| 184 | 184 | return ports.NewSerializedRuntimeObserver(runtimeObserverFunc(func(ports.RuntimeMark) {}), 1), errorCloser{err: traceCloseErr}, nil | |
| 185 | 185 | } | |
| 186 | 186 | t.Cleanup(func() { newPerformanceTrace = original }) | |
| 187 | + | t.Setenv("VEV", "") | |
| 187 | 188 | t.Setenv("XDG_STATE_HOME", t.TempDir()) | |
| 188 | 189 | t.Setenv("XDG_RUNTIME_DIR", t.TempDir()) | |
| 189 | 190 | t.Setenv(envRemoteTransport, "invalid") | |
| 190 | 191 | ||
| 191 | 192 | err := runAttach(context.Background(), ports.IntentEphemeral, "", "host") | |
| 193 | + | if !strings.Contains(err.Error(), "invalid remote transport") { | |
| 194 | + | t.Fatalf("runAttach() error = %v, want remote transport validation error", err) | |
| 195 | + | } | |
| 192 | 196 | if !errors.Is(err, traceCloseErr) { | |
| 193 | 197 | t.Fatalf("runAttach() error = %v, want joined trace close error %v", err, traceCloseErr) | |
| 194 | 198 | } | |
| @@ -184,11 +184,15 @@ func TestRunAttachJoinsTraceCloseError(t *testing.T) { | |||||
| 184 | return ports.NewSerializedRuntimeObserver(runtimeObserverFunc(func(ports.RuntimeMark) {}), 1), errorCloser{err: traceCloseErr}, nil | 184 | return ports.NewSerializedRuntimeObserver(runtimeObserverFunc(func(ports.RuntimeMark) {}), 1), errorCloser{err: traceCloseErr}, nil | ||
| 185 | } | 185 | } | ||
| 186 | t.Cleanup(func() { newPerformanceTrace = original }) | 186 | t.Cleanup(func() { newPerformanceTrace = original }) | ||
| 187 | + | t.Setenv("VEV", "") | |||
| 187 | t.Setenv("XDG_STATE_HOME", t.TempDir()) | 188 | t.Setenv("XDG_STATE_HOME", t.TempDir()) | ||
| 188 | t.Setenv("XDG_RUNTIME_DIR", t.TempDir()) | 189 | t.Setenv("XDG_RUNTIME_DIR", t.TempDir()) | ||
| 189 | t.Setenv(envRemoteTransport, "invalid") | 190 | t.Setenv(envRemoteTransport, "invalid") | ||
| 190 | 191 | ||||
| 191 | err := runAttach(context.Background(), ports.IntentEphemeral, "", "host") | 192 | err := runAttach(context.Background(), ports.IntentEphemeral, "", "host") | ||
| 193 | + | if !strings.Contains(err.Error(), "invalid remote transport") { | |||
| 194 | + | t.Fatalf("runAttach() error = %v, want remote transport validation error", err) | |||
| 195 | + | } | |||
| 192 | if !errors.Is(err, traceCloseErr) { | 196 | if !errors.Is(err, traceCloseErr) { | ||
| 193 | t.Fatalf("runAttach() error = %v, want joined trace close error %v", err, traceCloseErr) | 197 | t.Fatalf("runAttach() error = %v, want joined trace close error %v", err, traceCloseErr) | ||
| 194 | } | 198 | } | ||