mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 16:40:21 +00:00
fix(agentcompat): resolve trusted Go executable
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
1 parent
e20197fdcc
commit
9bc3068d14
2 files changed
+45
-1
No files matched your search
@@ -122,6 +122,23 @@ func TestWorkspace_BuildsBinaryInRunDirectory(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWorkspace_ResolvesAbsoluteRegularGoExecutable(t *testing.T) {
|
||||
// When
|
||||
path, err := resolveGoExecutable()
|
||||
|
||||
// Then
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !filepath.IsAbs(path) {
|
||||
t.Fatalf("Go executable path is not absolute: %s", path)
|
||||
}
|
||||
info, err := os.Stat(path)
|
||||
if err != nil || !info.Mode().IsRegular() || info.Mode()&0o111 == 0 {
|
||||
t.Fatalf("Go executable is not an executable regular file: info=%v err=%v", info, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWorkspace_PreservesEvidenceWhenTrackedPIDRemains(t *testing.T) {
|
||||
// Given
|
||||
workspace, err := New(context.Background())
|
||||
|
||||
Reference in new issue
Block a user