-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Problem
The prober package has 0% test coverage and needs comprehensive testing.
Current State
- ❌
proberpackage: 0% test coverage - No tests for
Interfaceimplementation - No tests for
Funcwrapper - No tests for
Gofunction - No tests for authorization handling
- No tests for error handling
Acceptance Criteria
-
Interfaceimplementation tested -
Funcwrapper tested -
Gofunction tested with various scenarios - Authorization handling tested
- Error handling tested
- Test coverage >80%
Tasks
Core Interface Testing
-
Test
Interfaceimplementationfunc TestInterface(t *testing.T) { // Test that Interface can be implemented var _ prober.Interface = &mockProber{} }
-
Test
Funcwrapperfunc TestFunc(t *testing.T) { called := false fn := prober.Func(func(ctx context.Context) error { called = true return nil }) err := fn.Probe(context.Background()) assert.NoError(t, err) assert.True(t, called) }
Go Function Testing
- Test
Gofunction with valid authorization - Test
Gofunction with invalid authorization - Test
Gofunction with missing authorization - Test
Gofunction with probe errors - Test
Gofunction with different ports
Authorization Testing
- Test valid authorization header
- Test invalid authorization header
- Test missing authorization header
- Test authorization environment variable
Error Handling Testing
- Test probe function returning errors
- Test HTTP server errors
- Test context cancellation
- Test timeout scenarios
Test Files to Create
pkg/prober/prober_test.go
Success Metrics
- Target: >80% test coverage
- Current: 0%
- Measurement:
go test -coverprofile=coverage.out ./pkg/prober/...
Metadata
Metadata
Assignees
Labels
No labels