This commit was merged in pull request #32.
This commit is contained in:
@@ -297,6 +297,24 @@ func TestNewDigest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentsOwnServiceIsStartedLast(t *testing.T) {
|
||||
ref := repoA + ":1.4"
|
||||
own := svc(1, ref+"@sha256:old")
|
||||
own.UpdateMode, own.Self = model.ModeAuto, true
|
||||
other := svc(2, ref+"@sha256:old")
|
||||
other.UpdateMode = model.ModeAuto
|
||||
st := &fakeStore{services: []model.Service{own, other}}
|
||||
reg := &fakeRegistry{digests: map[string]string{ref: "sha256:new"}}
|
||||
j := &fakeJobs{}
|
||||
p, _ := newPoller(st, j, reg, Config{})
|
||||
|
||||
p.Cycle(context.Background())
|
||||
|
||||
require.Len(t, j.starts, 2)
|
||||
assert.Equal(t, int64(2), j.starts[0].svcID)
|
||||
assert.Equal(t, int64(1), j.starts[1].svcID)
|
||||
}
|
||||
|
||||
func TestSameSuggestionIsIdempotent(t *testing.T) {
|
||||
ref := repoA + ":1.4"
|
||||
running := svc(1, ref+"@sha256:old")
|
||||
@@ -332,7 +350,7 @@ func TestStartErrorsDoNotAbortCycle(t *testing.T) {
|
||||
reg := &fakeRegistry{digests: map[string]string{ref: "sha256:new"}}
|
||||
j := &fakeJobs{errFor: map[int64]error{
|
||||
1: model.ErrJobActive,
|
||||
2: &model.NotUpdatableError{Reason: model.ReasonSelf},
|
||||
2: &model.NotUpdatableError{Reason: model.ReasonContainer},
|
||||
3: errors.New("database down"),
|
||||
}}
|
||||
p, _ := newPoller(st, j, reg, Config{})
|
||||
|
||||
Reference in New Issue
Block a user