支持Git提交导入及未提交源码叠加,APK原名下载和完成通知。新增服务端设备安装与按工程维护的私有文件清单,修复Wrapper预检查、布局及IDE读锁和保存状态问题。更新协议、测试和部署记录;服务端0.7.0,插件0.7.1。
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestExplicitWorkspaceSupportFilesAreConfined(t *testing.T) {
|
|
s := testServer(t)
|
|
p := project(t, s)
|
|
pr := s.projects[p]
|
|
pr.Dedicated = true
|
|
pr.WorkspacePath = t.TempDir()
|
|
cert := filepath.Join(t.TempDir(), "HONOR.CER")
|
|
key := filepath.Join(t.TempDir(), "key.jks")
|
|
writeFixture(t, cert, "certificate")
|
|
writeFixture(t, key, "key material")
|
|
c := BuildEnvironment{WorkspaceFiles: map[string]map[string]string{pr.WorkspacePath: {"cer/HONOR.CER": cert, "work/app/key.jks": key}}}
|
|
if e := s.prepareWorkspaceFiles(p, c); e != nil {
|
|
t.Fatal(e)
|
|
}
|
|
root := filepath.Join(s.root, "projects", p)
|
|
for relative, want := range map[string]string{"cer/HONOR.CER": "certificate", "work/app/key.jks": "key material"} {
|
|
data, e := os.ReadFile(filepath.Join(root, filepath.FromSlash(relative)))
|
|
if e != nil || string(data) != want {
|
|
t.Fatal(relative, e)
|
|
}
|
|
}
|
|
for _, target := range []string{"../escape.cer", "work/.git/hooks/key.jks", "work/public.cer", "work/build/key.jks", "state.json"} {
|
|
c.WorkspaceFiles[pr.WorkspacePath] = map[string]string{target: cert}
|
|
if e := s.prepareWorkspaceFiles(p, c); e == nil {
|
|
t.Fatal("unsafe support target accepted", target)
|
|
}
|
|
}
|
|
}
|