feat: 增加环境预检查与多根目录支持,调整构建操作布局
This commit is contained in:
1 parent
2cb70beb69
commit
7984785610
17 files changed
+852
-97
No files matched your search
@@ -24,6 +24,21 @@ func TestManifestRechecksActualContent(t *testing.T) {
|
||||
t.Fatal(w.Body.String())
|
||||
}
|
||||
}
|
||||
func TestChangedWorkspaceRootRetainsHistoryButBlocksSourceAccess(t *testing.T) {
|
||||
s:=testServer(t);oldRoot:=t.TempDir();s.workspaceRoot=oldRoot
|
||||
work:=filepath.Join(oldRoot,"old-project");os.MkdirAll(work,0700)
|
||||
w:=call(t,s,"POST","/projects",WorkspaceRequest{WorkspacePath:work})
|
||||
if w.Code!=200 {t.Fatal(w.Body.String())}
|
||||
var allocated map[string]string;json.Unmarshal(w.Body.Bytes(),&allocated);p:=allocated["id"]
|
||||
b:=&Build{ID:id(),Project:p,Status:"success",Logs:[]string{},Artifacts:[]Artifact{}}
|
||||
s.builds[b.ID]=b
|
||||
s.workspaceRoot=t.TempDir()
|
||||
if w=call(t,s,"GET","/projects/"+p+"/builds",nil);w.Code!=200{t.Fatal("history blocked by root change",w.Body.String())}
|
||||
if w=call(t,s,"GET","/builds/"+b.ID,nil);w.Code!=200{t.Fatal("build record unavailable")}
|
||||
if w=call(t,s,"GET","/projects/"+p+"/manifest",nil);w.Code!=400{t.Fatal("out-of-root source readable")}
|
||||
if w=call(t,s,"POST","/projects/"+p+"/sync",SyncRequest{Revision:"new",Files:map[string]File{"file.txt":file("data")}});w.Code!=400{t.Fatal("out-of-root source writable")}
|
||||
if _,e:=os.Stat(filepath.Join(work,"file.txt"));!os.IsNotExist(e){t.Fatal("source changed")}
|
||||
}
|
||||
func TestExistingWorkspaceBoundaryAndGitProtection(t *testing.T) {
|
||||
if _, e := exec.LookPath("git"); e != nil {
|
||||
t.Skip("git unavailable")
|
||||
|
||||
Reference in new issue
Block a user