Skip to content

Commit 86a3868

Browse files
committed
WIP re-enable agent test
1 parent 3a6d950 commit 86a3868

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

internal/agent/agent_test.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package agent
22

33
import (
4+
"os"
5+
"runtime"
46
"testing"
57
"time"
68

@@ -11,10 +13,9 @@ import (
1113
)
1214

1315
func TestRun(t *testing.T) {
14-
// TODO: Revisit this test - currently failing in CI
15-
// The test subcase "should_handle_invalid_glob_pattern" is failing.
16-
// May be related to environment differences or test expectations needing adjustment.
17-
t.Skip("Skipping until invalid glob pattern handling can be reviewed")
16+
// Tests basic mode validation error cases that return immediately
17+
t.Logf("DEBUG: TestRun starting - GOOS=%s GOARCH=%s NumCPU=%d", runtime.GOOS, runtime.GOARCH, runtime.NumCPU())
18+
t.Logf("DEBUG: Working dir: %s", mustGetwd())
1819

1920
// Save original config and restore after tests
2021
originalConfig := config.GlobalConfig
@@ -66,11 +67,9 @@ func TestRun(t *testing.T) {
6667
}
6768

6869
func TestModeValidation(t *testing.T) {
69-
// TODO: Revisit this test - currently failing in CI
70-
// The test validates mode combinations (ondemand, m3, api) but has timing/blocking issues
71-
// with goroutines and channels. Needs investigation of async behavior in CI environment.
72-
// Related tests: m3 only, api only, ondemand_and_m3_conflict, m3_and_api_together, ondemand_and_api_together
73-
t.Skip("Skipping until mode validation async behavior can be fixed")
70+
// Tests various mode combinations with goroutine-based timeout detection
71+
// Valid modes (m3, api) block indefinitely, so timeout = success for those cases
72+
t.Logf("DEBUG: TestModeValidation starting - GOOS=%s GOARCH=%s", runtime.GOOS, runtime.GOARCH)
7473

7574
// Save original config and restore after tests
7675
originalConfig := config.GlobalConfig
@@ -194,10 +193,8 @@ func TestModeValidation(t *testing.T) {
194193
}
195194

196195
func TestResolvePidsFromToken(t *testing.T) {
197-
// TODO: Revisit this test - currently failing in CI
198-
// Test attempts to resolve PIDs from process tokens but may depend on
199-
// environment-specific processes that don't exist in CI. Needs mocking.
200-
t.Skip("Skipping until PID resolution can be properly mocked")
196+
// Tests PID resolution from process tokens - uses nonexistent token to avoid env dependency
197+
t.Logf("DEBUG: TestResolvePidsFromToken starting - GOOS=%s", runtime.GOOS)
201198

202199
// Save original config and restore after tests
203200
originalConfig := config.GlobalConfig
@@ -216,9 +213,9 @@ func TestResolvePidsFromToken(t *testing.T) {
216213
}
217214

218215
func TestModeLogic(t *testing.T) {
219-
// TODO: Revisit this test - currently failing in CI
220-
// Empty test that may have been a placeholder. Needs implementation or removal.
221-
t.Skip("Skipping empty test - needs implementation")
216+
// Placeholder test for future mode logic validation
217+
// Currently validates test infrastructure only
218+
t.Logf("DEBUG: TestModeLogic - placeholder test")
222219

223220
// Save original config and restore after tests
224221
originalConfig := config.GlobalConfig
@@ -228,4 +225,16 @@ func TestModeLogic(t *testing.T) {
228225

229226
// Initialize logger for tests
230227
logger.Init("", 0, 0, "info")
228+
229+
// Basic validation that config restoration works
230+
assert.NotNil(t, originalConfig)
231+
}
232+
233+
// mustGetwd returns current working directory or "unknown" on error
234+
func mustGetwd() string {
235+
wd, err := os.Getwd()
236+
if err != nil {
237+
return "unknown"
238+
}
239+
return wd
231240
}

0 commit comments

Comments
 (0)