MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / TestCreateKillOnCloseJob

Function TestCreateKillOnCloseJob

util/api_key_helper_windows_test.go:16–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestCreateKillOnCloseJob(t *testing.T) {
17 job, err := createKillOnCloseJob()
18 if err != nil {
19 t.Fatalf("createKillOnCloseJob() error = %v, want nil", err)
20 }
21 defer func() {
22 _ = windows.CloseHandle(job)
23 }()
24
25 // Verify that the job handle is valid
26 if job == 0 {
27 t.Error("createKillOnCloseJob() returned invalid handle")
28 }
29
30 // Verify that KILL_ON_JOB_CLOSE flag is set
31 var info windows.JOBOBJECT_EXTENDED_LIMIT_INFORMATION
32 var returnLength uint32
33 err = windows.QueryInformationJobObject(
34 job,
35 windows.JobObjectExtendedLimitInformation,
36 uintptr(unsafe.Pointer(&info)),
37 uint32(unsafe.Sizeof(info)),
38 &returnLength,
39 )
40 if err != nil {
41 t.Fatalf("QueryInformationJobObject() error = %v", err)
42 }
43
44 if info.BasicLimitInformation.LimitFlags&windows.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE == 0 {
45 t.Error("KILL_ON_JOB_CLOSE flag is not set")
46 }
47}
48
49func TestAssignProcessToJob_InvalidPID(t *testing.T) {
50 job, err := createKillOnCloseJob()

Callers

nothing calls this directly

Calls 1

createKillOnCloseJobFunction · 0.85

Tested by

no test coverage detected