feat: master/agent phase 4 — registry polling and version history (#9) (#23)
Docker Build / docker (push) Successful in 47s

This commit was merged in pull request #23.
This commit is contained in:
2026-10-13 07:02:34 +00:00
parent 41a619b316
commit 1664e47183
46 changed files with 3357 additions and 130 deletions
+21 -1
View File
@@ -22,7 +22,7 @@ func setAll(t *testing.T) {
for k, v := range required {
t.Setenv(k, v)
}
for _, k := range []string{"PORT", "AGENT_PORT", "AGENT_IMAGE", "LOG_LEVEL", "UPDATER_API_KEY", "UPDATE_TIMEOUT"} {
for _, k := range []string{"PORT", "AGENT_PORT", "AGENT_IMAGE", "LOG_LEVEL", "UPDATER_API_KEY", "UPDATE_TIMEOUT", "POLL_INTERVAL"} {
t.Setenv(k, "")
}
}
@@ -38,6 +38,26 @@ func TestLoad_Defaults(t *testing.T) {
assert.Equal(t, "updater-admins", cfg.AllowedGroup)
assert.Empty(t, cfg.UpdaterAPIKey)
assert.Equal(t, 5*time.Minute, cfg.UpdateTimeout)
assert.Equal(t, 6*time.Hour, cfg.PollInterval)
}
func TestLoad_PollInterval(t *testing.T) {
setAll(t)
t.Setenv("POLL_INTERVAL", "30m")
cfg, err := Load()
require.NoError(t, err)
assert.Equal(t, 30*time.Minute, cfg.PollInterval)
}
func TestLoad_InvalidPollInterval(t *testing.T) {
for _, v := range []string{"abc", "0s", "-1h", "6"} {
t.Run(v, func(t *testing.T) {
setAll(t)
t.Setenv("POLL_INTERVAL", v)
_, err := Load()
assert.ErrorContains(t, err, "POLL_INTERVAL must be a positive duration such as 6h, got")
})
}
}
func TestLoad_WebhookSettings(t *testing.T) {