34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package target_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"proxyctl/internal/profile"
|
|
"proxyctl/internal/target"
|
|
)
|
|
|
|
type seamTarget struct{}
|
|
|
|
func (seamTarget) ID() string { return "seam" }
|
|
func (seamTarget) Description() target.Description {
|
|
return target.Description{Name: "Seam", Summary: "summary", Details: "details"}
|
|
}
|
|
func (seamTarget) Availability(context.Context) target.Availability {
|
|
return target.Availability{Available: true, Evidence: "detected"}
|
|
}
|
|
func (seamTarget) Inspect(context.Context, *profile.Profile) target.Inspection {
|
|
return target.Inspection{State: target.Disabled, Evidence: "absent"}
|
|
}
|
|
func (seamTarget) Confirmation(bool) string { return "" }
|
|
func (seamTarget) SetDesired(context.Context, bool, *profile.Profile) target.OperationResult {
|
|
return target.OperationResult{Inspection: target.Inspection{State: target.Enabled}}
|
|
}
|
|
|
|
func TestSharedTargetInterfaceDoesNotExposePlatformDetails(t *testing.T) {
|
|
var adapter target.Target = seamTarget{}
|
|
if adapter.ID() != "seam" || !adapter.Availability(context.Background()).Available {
|
|
t.Fatal("Target seam did not expose expected domain behavior")
|
|
}
|
|
}
|