Index restore report action updates
This commit is contained in:
@@ -740,3 +740,20 @@ func TestExecuteRestoreInstallsOptionalPrerequisiteHistory(t *testing.T) {
|
||||
root := artifacts.SessionWorkDirForCampaign(workspaceRoot, cfg.Session.Campaign, cfg.Session.SessionID)
|
||||
mustReadEquals(t, filepath.Join(root, "inputs", "previous", "artifacts", "session_recap.md"), "optional history\n")
|
||||
}
|
||||
|
||||
func TestRestoreReportUpdatesFirstDuplicateAndCountsUnmatched(t *testing.T) {
|
||||
action := RestoreAction{Kind: RestoreActionDownload, LocalRelativePath: "inputs/a", RemoteKey: "remote/a"}
|
||||
report, err := newRestoreReport(&RemoteCurrentState{}, &RestorePlan{Actions: []RestoreAction{action, action}}, RestorePlanOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
report.markDownloaded(action)
|
||||
report.markFailed(RestoreAction{LocalRelativePath: "missing", RemoteKey: "missing"}, nil)
|
||||
if report.Actions[0].Status != "downloaded" || report.Actions[1].Status != "planned_download" || report.Execution.Downloaded != 1 || report.Execution.Failed != 1 {
|
||||
t.Fatalf("unexpected report: %+v", report)
|
||||
}
|
||||
data, err := json.Marshal(report)
|
||||
if err != nil || strings.Contains(string(data), "actionIndices") {
|
||||
t.Fatalf("serialized report = %s, error = %v", data, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user