refactor: use nginx -s reload instead of systemd
- doc: add comment
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestStoreCommitsAndReusesImmutableFile 验证 Commit 首次写入会创建文件且 Reused 为 false,
|
||||
// 第二次写入相同身份时按幂等返回 Reused 为 true 且路径一致。
|
||||
func TestStoreCommitsAndReusesImmutableFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
store, err := New(t.TempDir())
|
||||
@@ -38,6 +40,8 @@ func TestStoreCommitsAndReusesImmutableFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStoreInspectsCommittedIdentityWithoutMutation 验证 Inspect 能校验已提交文件的身份、
|
||||
// 正确处理不存在的文件或目录,并对身份不符返回 ErrDestinationConflict。
|
||||
func TestStoreInspectsCommittedIdentityWithoutMutation(t *testing.T) {
|
||||
t.Parallel()
|
||||
store, err := New(t.TempDir())
|
||||
@@ -67,6 +71,8 @@ func TestStoreInspectsCommittedIdentityWithoutMutation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStoreRejectsMismatchAndNeverPublishesInvalidFile 验证身份不符时 Commit 返回错误,
|
||||
// 且目标路径上不会留下任何已发布的文件。
|
||||
func TestStoreRejectsMismatchAndNeverPublishesInvalidFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
root := t.TempDir()
|
||||
@@ -86,6 +92,7 @@ func TestStoreRejectsMismatchAndNeverPublishesInvalidFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStoreRejectsNilSource 验证 Commit 传入 nil source 时会被拒绝。
|
||||
func TestStoreRejectsNilSource(t *testing.T) {
|
||||
t.Parallel()
|
||||
store, err := New(t.TempDir())
|
||||
@@ -97,6 +104,8 @@ func TestStoreRejectsNilSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStoreRejectsExistingDifferentContentAndPathEscape 验证目标已存在不同内容时返回
|
||||
// ErrDestinationConflict,且通过 ../ 越界的相对路径会被拒绝。
|
||||
func TestStoreRejectsExistingDifferentContentAndPathEscape(t *testing.T) {
|
||||
t.Parallel()
|
||||
root := t.TempDir()
|
||||
@@ -117,6 +126,8 @@ func TestStoreRejectsExistingDifferentContentAndPathEscape(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStoreRejectsSymlinkedParentOutsideRoot 验证父目录为指向根目录之外的符号链接时,
|
||||
// Commit 会被拒绝,防止文件通过符号链接写出存储根目录。
|
||||
func TestStoreRejectsSymlinkedParentOutsideRoot(t *testing.T) {
|
||||
t.Parallel()
|
||||
root := t.TempDir()
|
||||
@@ -134,6 +145,7 @@ func TestStoreRejectsSymlinkedParentOutsideRoot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// identityOf 根据 content 计算其 SHA-256 摘要并返回对应的 Identity,供测试构造期望身份。
|
||||
func identityOf(content []byte) Identity {
|
||||
digest := sha256.Sum256(content)
|
||||
return Identity{Size: int64(len(content)), SHA256: hex.EncodeToString(digest[:])}
|
||||
|
||||
Reference in New Issue
Block a user