MCPcopy
hub / github.com/basecamp/once / TestUpdateDue

Function TestUpdateDue

internal/docker/state_test.go:44–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestUpdateDue(t *testing.T) {
45 t.Run("due when app has no state", func(t *testing.T) {
46 s := &State{}
47 assert.True(t, s.UpdateDue("myapp"))
48 })
49
50 t.Run("not due when last update was recent and successful", func(t *testing.T) {
51 s := &State{Apps: map[string]*AppState{
52 "myapp": {LastUpdate: OperationResult{At: time.Now().Add(-time.Second)}},
53 }}
54 assert.False(t, s.UpdateDue("myapp"))
55 })
56
57 t.Run("due when last update was recent but had an error", func(t *testing.T) {
58 s := &State{Apps: map[string]*AppState{
59 "myapp": {LastUpdate: OperationResult{At: time.Now().Add(-time.Second), Error: "pull failed"}},
60 }}
61 assert.True(t, s.UpdateDue("myapp"))
62 })
63}
64
65func TestRecordBackup(t *testing.T) {
66 t.Run("records successful backup", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

UpdateDueMethod · 0.95
AddMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…