fix: finish progressive Target detection
This commit is contained in:
@@ -46,6 +46,19 @@ func TestAvailabilityRequiresDebianMarkerAPTToolAndConfigurationDirectory(t *tes
|
||||
}
|
||||
}
|
||||
|
||||
func TestDetectClassifiesInspectionFailureAndUsesOneEffectiveConfigurationProbe(t *testing.T) {
|
||||
a, runner := newAdapter(t, nil)
|
||||
runner.outputError = true
|
||||
|
||||
detection := a.Detect(context.Background(), compatibleProfile())
|
||||
if detection.Err == nil || detection.Inspection.State != target.Disabled {
|
||||
t.Fatalf("detection = %#v, want failed Disabled inspection", detection)
|
||||
}
|
||||
if runner.outputs != 1 {
|
||||
t.Fatalf("Detect issued %d apt-config dumps, want one", runner.outputs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDiagnosticChecksCoverCommandSchemaAndAuthorityWithoutMutation(t *testing.T) {
|
||||
a, _ := newAdapter(t, nil)
|
||||
checks := a.DiagnosticChecks(context.Background(), compatibleProfile())
|
||||
@@ -442,6 +455,7 @@ func newFailingAdapter(t *testing.T, files *failingFS) (*apt.Adapter, *fakeRunne
|
||||
type fakeRunner struct {
|
||||
available, outputError bool
|
||||
overlay, external, override, failDumpAfterWrite string
|
||||
outputs int
|
||||
}
|
||||
|
||||
func (r *fakeRunner) LookPath(string) (string, error) {
|
||||
@@ -451,6 +465,7 @@ func (r *fakeRunner) LookPath(string) (string, error) {
|
||||
return "/usr/bin/apt-config", nil
|
||||
}
|
||||
func (r *fakeRunner) Output(context.Context, string, ...string) ([]byte, error) {
|
||||
r.outputs++
|
||||
if r.outputError {
|
||||
return nil, errors.New("apt-config dump failed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user