-
Notifications
You must be signed in to change notification settings - Fork 3
Add scheduled instance snapshots with retention cleanup #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sjmiller609
wants to merge
20
commits into
main
Choose a base branch
from
codex/snapshot-schedule-retention
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4ee369f
feat: add scheduled snapshots with retention cleanup
sjmiller609 c16caac
fix: aggregate scheduled snapshot runner errors
sjmiller609 c13fcdc
perf: scan schedule index and reduce lock contention
sjmiller609 51c97f3
fix: validate scheduled snapshot name prefix length
sjmiller609 12c7c55
refactor: move scheduled snapshot domain logic to lib package
sjmiller609 b8cca6c
fix: ignore missing snapshots during retention cleanup
sjmiller609 d172b0a
chore: remove dead wrapper and align retention schema
sjmiller609 e8a4a3d
fix: tighten schedule run due-check under write lock
sjmiller609 666e14c
feat: auto-select scheduled snapshot kind and retain post-delete sche…
sjmiller609 84bd548
fix: return 404 when scheduling a missing instance
sjmiller609 0430e6c
fix: retire converged deleted-instance schedules
sjmiller609 77e55a1
chore: remove test-only snapshot schedule aliases
sjmiller609 6aa101f
fix: preserve schedule runtime history on updates
sjmiller609 c346a1f
fix: tighten schedule retention request handling
sjmiller609 84ef7c8
fix: honor cancellation in schedule runner loop
sjmiller609 1108cd8
fix: preserve explicit zero retention settings
sjmiller609 b9013e7
Merge origin/main into codex/snapshot-schedule-retention
sjmiller609 6db9b1c
fix: evaluate schedule timing per-instance
sjmiller609 c94c292
fix: make schedule interval step arithmetic explicit
sjmiller609 1104580
Merge origin/main into codex/snapshot-schedule-retention
sjmiller609 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package api | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/kernel/hypeman/lib/instances" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestSnapshotScheduleToOAPIPreservesZeroMaxCount(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| schedule := instances.SnapshotSchedule{ | ||
| InstanceID: "inst-1", | ||
| Interval: time.Hour, | ||
| Retention: instances.SnapshotScheduleRetention{ | ||
| MaxCount: 0, | ||
| MaxAge: 24 * time.Hour, | ||
| }, | ||
| NextRunAt: time.Now().UTC().Add(time.Hour), | ||
| CreatedAt: time.Now().UTC(), | ||
| UpdatedAt: time.Now().UTC(), | ||
| } | ||
|
|
||
| out := snapshotScheduleToOAPI(schedule) | ||
| require.NotNil(t, out.Retention.MaxCount) | ||
| assert.Equal(t, 0, *out.Retention.MaxCount) | ||
| require.NotNil(t, out.Retention.MaxAge) | ||
| assert.Equal(t, "24h0m0s", *out.Retention.MaxAge) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.