feat: 增加 DockerExecutor 运行容器时挂载管理文件的测试用例

This commit is contained in:
ryan
2026-03-12 22:52:48 +08:00
parent 594057be06
commit eafcac87a4
3 changed files with 145 additions and 12 deletions
+18
View File
@@ -137,6 +137,15 @@ func TestSyncOnceSuccess(t *testing.T) {
if len(client.reports) != 1 || client.reports[0].Result != ApplyResultSuccess {
t.Fatal("expected successful apply report to be sent")
}
if client.reports[0].Checksum != "checksum-1" {
t.Fatalf("expected config checksum to be reported, got %q", client.reports[0].Checksum)
}
if client.reports[0].MainConfigChecksum == "" || client.reports[0].RouteConfigChecksum == "" {
t.Fatal("expected main and route config checksums to be reported")
}
if client.reports[0].SupportFileCount != 1 {
t.Fatalf("expected support file count to be reported, got %d", client.reports[0].SupportFileCount)
}
}
func TestSyncOnceRollbackOnNginxFailure(t *testing.T) {
@@ -212,6 +221,15 @@ func TestSyncOnceRollbackOnNginxFailure(t *testing.T) {
if len(client.reports) != 1 || client.reports[0].Result != ApplyResultFailed {
t.Fatal("expected failed apply report to be sent")
}
if client.reports[0].Checksum != "checksum-2" {
t.Fatalf("expected failed report to retain target checksum, got %q", client.reports[0].Checksum)
}
if client.reports[0].MainConfigChecksum == "" || client.reports[0].RouteConfigChecksum == "" {
t.Fatal("expected failed report to include main and route config checksums")
}
if client.reports[0].SupportFileCount != 1 {
t.Fatalf("expected failed report to include support file count, got %d", client.reports[0].SupportFileCount)
}
}
func TestSyncOnStartupRecreatesRuntimeWhenChecksumMatches(t *testing.T) {