mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-17 23:01:32 +00:00
Validate registration retry intervals.
Reject register-only configs that leave the shared retry interval at the zero value so failed registration attempts cannot spin in a tight loop. Cover the regression in tests and make the register-only integration test explicit about its retry interval. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
273af4b0ab
commit
48a05fda1c
3 changed files with 32 additions and 8 deletions
|
|
@ -93,3 +93,22 @@ func TestNewRejectsRegistrationWithoutMachineID(t *testing.T) {
|
|||
t.Fatalf("error = %q, want missing-machine-id message", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewRejectsRegistrationWithoutHeartbeatInterval(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
_, err := New(Config{
|
||||
ExportPath: t.TempDir(),
|
||||
ListenAddress: defaultListenAddress(defaultPort),
|
||||
MachineID: "nas-1",
|
||||
ControlPlaneURL: "http://127.0.0.1:8081",
|
||||
RegisterEnabled: true,
|
||||
}, log.New(io.Discard, "", 0))
|
||||
if err == nil {
|
||||
t.Fatal("expected missing registration retry interval to fail")
|
||||
}
|
||||
|
||||
if !strings.Contains(err.Error(), "BETTERNAS_NODE_HEARTBEAT_INTERVAL") {
|
||||
t.Fatalf("error = %q, want missing-heartbeat-interval message", err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue