18 lines
564 B
Go
18 lines
564 B
Go
package supervisor_test
|
|
|
|
import (
|
|
"git.cin.su/m/Assistant/runtime/supervisor"
|
|
"testing"
|
|
)
|
|
|
|
func TestLifeboatRollsBackCandidateToLastKnownGood(t *testing.T) {
|
|
l := supervisor.Lifeboat{}
|
|
l.Start(supervisor.Release{ID: "good", Version: "1"})
|
|
l.Record(supervisor.Observation{ReleaseID: "good", Ready: true})
|
|
l.Start(supervisor.Release{ID: "candidate", Version: "2"})
|
|
l.Record(supervisor.Observation{ReleaseID: "candidate", Ready: false})
|
|
if !l.Rollback() || l.Current.ID != "good" || l.Current.State != supervisor.ReleaseRolledBack {
|
|
t.Fatalf("%#v", l)
|
|
}
|
|
}
|