Files
Redflag/aggregator-agent/internal/logging/example_integration_test.go
jpetree331 db67049e92 fix(identity): D-1 machine ID deduplication fixes
- Remove unhashed 'unknown-' fallback from registration (F-D1-1)
  Registration aborts if GetMachineID() fails (no bad data)
- Add POST /admin/agents/:id/rebind-machine-id endpoint (F-D1-2)
  Admin can update stored machine ID after hardware change
- Delete dead example_integration.go with wrong usage (F-D1-3)
- Remove redundant Windows machineid.ID() retry (F-D1-4)
- Replace fmt.Printf with log.Printf in client.go (F-D1-5)

Operator note: agents registered with 'unknown-' machine IDs
must be rebound before upgrading. See D1_Fix_Implementation.md.

All tests pass. No regressions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 09:53:43 -04:00

44 lines
1.5 KiB
Go

package logging
// example_integration_test.go — Pre-fix tests for dead example code.
//
// F-D1-3 LOW: example_integration.go is dead code calling machineid.ID()
// directly, bypassing the canonical hashMachineID().
//
// Run: cd aggregator-agent && go test ./internal/logging/... -v -run TestExample
import (
"os"
"testing"
)
// ---------------------------------------------------------------------------
// Test 4.1 — Documents dead code exists (F-D1-3)
//
// Category: PASS-NOW (documents dead code)
// ---------------------------------------------------------------------------
func TestExampleIntegrationFileIsDeadCode(t *testing.T) {
// POST-FIX (F-D1-3): File deleted.
_, err := os.Stat("example_integration.go")
if err == nil {
t.Error("[ERROR] [agent] [logging] F-D1-3 NOT FIXED: dead code file still exists")
}
t.Log("[INFO] [agent] [logging] F-D1-3 FIXED: dead example code deleted")
}
// ---------------------------------------------------------------------------
// Test 4.2 — File should not exist (assert fix)
//
// Category: FAIL-NOW / PASS-AFTER-FIX
// ---------------------------------------------------------------------------
func TestExampleIntegrationFileDoesNotExist(t *testing.T) {
// F-D1-3: After fix, delete the file.
_, err := os.Stat("example_integration.go")
if err == nil {
t.Errorf("[ERROR] [agent] [logging] example_integration.go still exists.\n" +
"F-D1-3: delete dead example code with incorrect usage patterns.")
}
}