Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Prove that an exported archive matches a network server

未关闭
#386 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
django, postgresql, python, sqlite
领域
databases, testing

调研方向

Start with tests/testapp/tests/integration/test_disk_export.py and compare its setup with PushPullClientTestCase and LiveServer in tests/testapp/tests/integration/test_syncsession.py. Run python -O -m pytest tests/testapp/tests/integration/test_disk_export.py -v, then verify parity, archive contents, chunking results, failure cleanup, and the PostgreSQL integration suite with tox -e postgres -- tests/testapp/tests/integration.

由索引模型根据 Issue 内容生成。

描述

DEV: backend TAG: unit tests

Overview

Integration tests prove that a full export produces a complete archive with the same data as a network server that receives the same push. This issue is part of milestone M7 (verification).

Background & Motivation

The parity rule is the central promise of the design. An archive holds the same morango state as a server that receives the same push, plus a manifest. Future import (Phase 2) and incremental update (Phase 4) depend on this promise.

These tests also cover the full export flow through the public API, chunked transfers, and cleanup after a failure.

Design: spec. Plan: implementation plan, Task 25.

Description & Expected Outcomes

A parity test pushes the same facility data twice with the same filter. One push goes to the second-server test harness, and one push goes to a disk connection. The test compares the Store, RecordMaxCounter and DatabaseMaxCounter rows of the two receivers. The test ignores rows that use the instance ID of each receiver.

An end-to-end test runs a full export through the public API and reopens the archive. The archive must match every row of the "Archive contents at completion" table in spec §3.4.

A chunking test uses a small chunk size, so that the transfer takes more than one cycle. A failure test forces an error during the transfer. After the host closes the sync session and the connection, no archive file, partial file, lock file or archive alias remains.

Deliverables & Contracts

The feature delivers these capabilities:

  • A parity test against the second-server harness.
  • An end-to-end export test through create_disk_connection and the push client.
  • A chunking test and a failure-injection test.
Acceptance Criteria
  • The parity test finds equal Store, RecordMaxCounter and DatabaseMaxCounter rows in default2 and in the reopened archive.
  • The end-to-end test finds every row of the spec §3.4 contents table in the archive.
  • With chunk_size=2 and 5 records, the push transfer runs 3 times, with results PENDING, PENDING, COMPLETED.
  • If DiskSyncConnection.push_record_chunk raises OSError, run() raises MorangoError.
  • After the failure and a call to close_sync_session() and close(), no path, .partial or .lock file exists.
  • After the failure, no key that starts with ARCHIVE_ALIAS_PREFIX is in connections.databases.
  • All tests pass on SQLite and in the postgres tox environment.

Technical Pointers & Architecture

  • Target Components / Context: tests/testapp/tests/integration/test_disk_export.py.
  • Related Patterns: PushPullClientTestCase and LiveServer in tests/testapp/tests/integration/test_syncsession.py give the seed data and the second server.
  • Data Model & Schema Considerations: None.
  • Resilience & Failure Modes: The failure test covers the discard path of the archive.

Notes & Tradeoffs

  • Dependencies: Blocked by: #375 (deprecated network operation names and override order), #384 (disk Peer protocol). Blocks: #387.
  • Kolibri companion changes: See spec §3.9. Kolibri routers must allow morango migrations on aliases that start with morango_archive_. Kolibri settings overrides must list the Peer* operations.
  • Testing Requirements: Run python -O -m pytest tests/testapp/tests/integration/test_disk_export.py -v and tox -e postgres -- tests/testapp/tests/integration. With a PostgreSQL host, the archive stays SQLite.
  • Tradeoffs & Alternatives Considered: The tests read the server data from the default2 alias of the test settings.

Metadata

  • Complexity: Medium
  • Target Branch: release-v0.9.x

AI Usage

Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.

主要语言
Python
星标
15
派生
23
平均合并
1 天 11 小时
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/morango 的其他 Issue

查看 learningequality/morango 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。