MCPcopy
hub / github.com/slimtoolkit/slim / TestSimpleSensorRun_Controlled_CLI

Function TestSimpleSensorRun_Controlled_CLI

pkg/app/sensor/app_test.go:48–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestSimpleSensorRun_Controlled_CLI(t *testing.T) {
49 runID := newTestRun(t)
50 ctx := context.Background()
51
52 sensor := testsensor.NewSensorOrFail(t, ctx, t.TempDir(), runID, imageSimpleCLI)
53 defer sensor.Cleanup(t, ctx)
54
55 sensor.StartControlledOrFail(t, ctx)
56
57 sensor.SendStartCommandOrFail(t, ctx,
58 testsensor.NewMonitorStartCommand(
59 testsensor.WithSaneDefaults(),
60 testsensor.WithAppNameArgs("cat", "/etc/alpine-release"),
61 ),
62 )
63 sensor.ExpectEvent(t, event.StartMonitorDone)
64
65 time.Sleep(1 * time.Second)
66
67 sensor.SendStopCommandOrFail(t, ctx)
68 sensor.ExpectEvent(t, event.StopMonitorDone)
69
70 sensor.ShutdownOrFail(t, ctx)
71 sensor.WaitOrFail(t, ctx)
72
73 sensor.AssertSensorLogsContain(t, ctx, sensorFullLifecycleSequence...)
74 sensor.AssertTargetAppLogsContain(t, ctx, "3.16.2")
75
76 sensor.DownloadArtifactsOrFail(t, ctx)
77 sensor.AssertReportIncludesFiles(t, "/bin/cat", "/bin/busybox", "/etc/alpine-release")
78 sensor.AssertReportNotIncludesFiles(t, "/bin/echo2", "/etc/resolve.conf")
79}
80
81func TestSimpleSensorRun_Controlled_Service(t *testing.T) {
82 runID := newTestRun(t)

Callers

nothing calls this directly

Calls 13

newTestRunFunction · 0.85
StartControlledOrFailMethod · 0.80
ExpectEventMethod · 0.80
SendStopCommandOrFailMethod · 0.80
ShutdownOrFailMethod · 0.80
WaitOrFailMethod · 0.80

Tested by

no test coverage detected