Import resume test fails when the wall clock steps back
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Read internal/definitions/apply_resume_test.go, especially stateOf and TestApplyRunAgainFinishesAnImportAStopCutShort; the issue identifies the comparison and the export ordering behind the failure. Sort exported types by key before comparing the resumed and clean import states. Run that test, including the three other import scenarios that add a type; done when clock ordering no longer causes false failures and the existing state comparisons still cover the listed fields, groups, values, and revisions.
Written by the indexing model from the issue text.
Description
The test that stops an import and runs it again should fail only when the import leaves a different site, never because of the machine clock.
Current state: TestApplyRunAgainFinishesAnImportAStopCutShort compares the definitions export after a resumed import with the export after one clean run, using reflect.DeepEqual (internal/definitions/apply_resume_test.go:213). The export lists types in the order ListContentTypes returns them, ORDER BY t.created_at, t.key (internal/postgres/queries/types.sql:6-10). Both stamps come from the Go wall clock. Test setup stamps the recipe type in content.NewType (internal/content/types.go), and the import stamps the new wine type later in oneType (internal/definitions/apply.go:164). When the wall clock steps back between those two moments, wine gets the earlier stamp and the export lists post, wine, recipe instead of post, recipe, wine. Groups, values and revisions are still equal, but the comparison fails.
This was seen on a machine whose clock steps back about a second at a time. The databases pgtestdb kept from four failed subtests all held wine stamped about one second before recipe. Main failed 2 of 8 runs of this test alone there. Three other scenarios also add a type during the import and can fail the same way.
Proposal: in stateOf (internal/definitions/apply_resume_test.go:68-74), sort the exported types by key before the comparison. The import never sets the order of types, so the test still proves everything it proved before, every type field, every group in position order, every field, the item values and the revisions. The product keeps its type list order.
Trigger: found while reviewing #474, which does not touch this path.
- Dominant language
- Go
- Stars
- 293
- Forks
- 50
- Avg merge
- 15h 38m
- Merged PRs (30d)
- 126
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gopherium/gophenberg
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
gopherium/gophenberg#554 ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
gopherium/gophenberg#548 ·
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
gopherium/gophenberg#543 ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
gopherium/gophenberg#538 · 1 comment ·
Maintainers usually reply within 1 day
-
help wanted refactor
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gopherium/gophenberg#470 ·
Maintainers usually reply within 1 day
All issues in gopherium/gophenberg
Similar issues
-
[Bug]: ap gateway image build cannot find local policies on WindowsPossibly taken @Jayzilva claimed this today. OpenAspect/Configuration Severity/Major
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
wso2/api-platform#3912 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
keyxmakerx/Chronicle#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Gentleman-Programming/gentle-ai#5720 ·
Maintainers usually reply within 1 day
-
compress: block buffers get re-zeroed on every call, and the zeroing is immediately overwrittenOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/ch-go#1218 ·
Maintainers usually reply within 13 days