client: send "Complete" event in update checks
Needed in order to match update_engine behavior.
This commit is contained in:
parent
d946c1e7b2
commit
a2f653da34
3 changed files with 25 additions and 1 deletions
|
@ -14,7 +14,8 @@ These differences include:
|
|||
- No offline activity tracking.
|
||||
The protocol's ping mechanism allows for tracking application usage, reporting the number of days since the last ping and how many of those days saw active usage.
|
||||
CoreUpdate does not use this, instead assuming update clients are always online and checking in once every ~45-50 minutes.
|
||||
Each check in should include a ping and optionally an update check.
|
||||
Clients not actively updating should send only a ping, indicating CoreUpdate's "Instance-Hold" state.
|
||||
Clients requesting an update should send a ping, update check, and an UpdateComplete:SuccessReboot event indicating CoreUpdate's "Complete" state.
|
||||
|
||||
- Various protocol extensions/abuses.
|
||||
update_engine, likely due to earlier limitations of the protocol and Google's server implementation, uses a number of non-standard fields.
|
||||
|
|
|
@ -206,6 +206,11 @@ func (ac *AppClient) UpdateCheck() (*omaha.UpdateResponse, error) {
|
|||
app.AddPing()
|
||||
app.AddUpdateCheck()
|
||||
|
||||
// Tell CoreUpdate to consider us in its "Complete" state,
|
||||
// otherwise it interprets ping as "Instance-Hold" which is
|
||||
// nonsense when we are sending an update check!
|
||||
app.Events = append(app.Events, EventComplete)
|
||||
|
||||
ac.sentPing = true
|
||||
|
||||
appResp, err := ac.doReq(ac.apiEndpoint, req)
|
||||
|
|
|
@ -100,6 +100,15 @@ func TestClientNoUpdate(t *testing.T) {
|
|||
if len(r.checks) != 1 {
|
||||
t.Fatalf("expected 1 update check, not %d", len(r.checks))
|
||||
}
|
||||
|
||||
if len(r.events) != 1 {
|
||||
t.Fatalf("expected 1 event, not %d", len(r.events))
|
||||
}
|
||||
|
||||
if r.events[0].Type != omaha.EventTypeUpdateComplete ||
|
||||
r.events[0].Result != omaha.EventResultSuccessReboot {
|
||||
t.Fatalf("expected %#v, not %#v", EventComplete, r.events[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientWithUpdate(t *testing.T) {
|
||||
|
@ -132,6 +141,15 @@ func TestClientWithUpdate(t *testing.T) {
|
|||
if len(r.checks) != 1 {
|
||||
t.Fatalf("expected 1 update check, not %d", len(r.checks))
|
||||
}
|
||||
|
||||
if len(r.events) != 1 {
|
||||
t.Fatalf("expected 1 event, not %d", len(r.events))
|
||||
}
|
||||
|
||||
if r.events[0].Type != omaha.EventTypeUpdateComplete ||
|
||||
r.events[0].Result != omaha.EventResultSuccessReboot {
|
||||
t.Fatalf("expected %#v, not %#v", EventComplete, r.events[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientPing(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue