mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
feat(BRIDGE-266): heartbeat telemetry update; extra integration tests;
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
Feature: Send Telemetry Heartbeat
|
||||
Background:
|
||||
Given there exists an account with username "[user:user1]" and password "password"
|
||||
And there exists an account with username "[user:user2]" and password "password"
|
||||
And there exists an account with username "[user:user3]" and password "password"
|
||||
Then it succeeds
|
||||
When bridge starts
|
||||
Then it succeeds
|
||||
@ -12,28 +14,30 @@ Feature: Send Telemetry Heartbeat
|
||||
When the user logs in with username "[user:user1]" and password "password"
|
||||
And user "[user:user1]" finishes syncing
|
||||
Then bridge eventually sends the following heartbeat:
|
||||
"""
|
||||
"""
|
||||
{
|
||||
"MeasurementGroup": "bridge.any.usage",
|
||||
"Event": "bridge_heartbeat",
|
||||
"Event": "bridge_heartbeat_new",
|
||||
"Values": {
|
||||
"nb_account": 1
|
||||
"NumberConnectedAccounts": 1,
|
||||
"rolloutPercentage": 1
|
||||
},
|
||||
"Dimensions": {
|
||||
"auto_update": "on",
|
||||
"auto_start": "on",
|
||||
"beta": "off",
|
||||
"doh": "off",
|
||||
"split_mode": "off",
|
||||
"show_all_mail": "on",
|
||||
"imap_connection_mode": "starttls",
|
||||
"smtp_connection_mode": "starttls",
|
||||
"imap_port": "default",
|
||||
"smtp_port": "default",
|
||||
"cache_location": "default",
|
||||
"keychain_pref": "default",
|
||||
"prev_version": "0.0.0",
|
||||
"rollout": "42"
|
||||
"isAutoUpdateEnabled": "true",
|
||||
"isAutoStartEnabled": "true",
|
||||
"isBetaEnabled": "false",
|
||||
"isDohEnabled": "false",
|
||||
"usesSplitMode": "false",
|
||||
"useAllMail": "true",
|
||||
"useDefaultImapPort": "true",
|
||||
"useDefaultSmtpPort": "true",
|
||||
"useDefaultCacheLocation": "true",
|
||||
"useDefaultKeychain": "true",
|
||||
"isContactedByAppleNotes": "false",
|
||||
"imapConnectionMode": "starttls",
|
||||
"smtpConnectionMode": "starttls",
|
||||
"prevVersion": "0.0.0",
|
||||
"bridgePlanGroup": "unknown"
|
||||
}
|
||||
}
|
||||
"""
|
||||
@ -59,25 +63,27 @@ Feature: Send Telemetry Heartbeat
|
||||
"""
|
||||
{
|
||||
"MeasurementGroup": "bridge.any.usage",
|
||||
"Event": "bridge_heartbeat",
|
||||
"Event": "bridge_heartbeat_new",
|
||||
"Values": {
|
||||
"nb_account": 1
|
||||
"NumberConnectedAccounts": 1,
|
||||
"rolloutPercentage": 1
|
||||
},
|
||||
"Dimensions": {
|
||||
"auto_update": "off",
|
||||
"auto_start": "off",
|
||||
"beta": "off",
|
||||
"doh": "on",
|
||||
"split_mode": "off",
|
||||
"show_all_mail": "off",
|
||||
"imap_connection_mode": "ssl",
|
||||
"smtp_connection_mode": "ssl",
|
||||
"imap_port": "custom",
|
||||
"smtp_port": "custom",
|
||||
"cache_location": "custom",
|
||||
"keychain_pref": "custom",
|
||||
"prev_version": "0.0.0",
|
||||
"rollout": "42"
|
||||
"isAutoUpdateEnabled": "false",
|
||||
"isAutoStartEnabled": "false",
|
||||
"isBetaEnabled": "false",
|
||||
"isDohEnabled": "true",
|
||||
"usesSplitMode": "false",
|
||||
"useAllMail": "false",
|
||||
"useDefaultImapPort": "false",
|
||||
"useDefaultSmtpPort": "false",
|
||||
"useDefaultCacheLocation": "false",
|
||||
"useDefaultKeychain": "false",
|
||||
"isContactedByAppleNotes": "false",
|
||||
"imapConnectionMode": "ssl",
|
||||
"smtpConnectionMode": "ssl",
|
||||
"prevVersion": "0.0.0",
|
||||
"bridgePlanGroup": "unknown"
|
||||
}
|
||||
}
|
||||
"""
|
||||
@ -97,25 +103,105 @@ Feature: Send Telemetry Heartbeat
|
||||
"""
|
||||
{
|
||||
"MeasurementGroup": "bridge.any.usage",
|
||||
"Event": "bridge_heartbeat",
|
||||
"Event": "bridge_heartbeat_new",
|
||||
"Values": {
|
||||
"nb_account": 1
|
||||
"NumberConnectedAccounts": 1,
|
||||
"rolloutPercentage": 1
|
||||
},
|
||||
"Dimensions": {
|
||||
"auto_update": "on",
|
||||
"auto_start": "on",
|
||||
"beta": "off",
|
||||
"doh": "off",
|
||||
"split_mode": "on",
|
||||
"show_all_mail": "on",
|
||||
"imap_connection_mode": "starttls",
|
||||
"smtp_connection_mode": "starttls",
|
||||
"imap_port": "default",
|
||||
"smtp_port": "default",
|
||||
"cache_location": "default",
|
||||
"keychain_pref": "default",
|
||||
"prev_version": "0.0.0",
|
||||
"rollout": "42"
|
||||
"isAutoUpdateEnabled": "true",
|
||||
"isAutoStartEnabled": "true",
|
||||
"isBetaEnabled": "false",
|
||||
"isDohEnabled": "false",
|
||||
"usesSplitMode": "true",
|
||||
"useAllMail": "true",
|
||||
"useDefaultImapPort": "true",
|
||||
"useDefaultSmtpPort": "true",
|
||||
"useDefaultCacheLocation": "true",
|
||||
"useDefaultKeychain": "true",
|
||||
"isContactedByAppleNotes": "false",
|
||||
"imapConnectionMode": "starttls",
|
||||
"smtpConnectionMode": "starttls",
|
||||
"prevVersion": "0.0.0",
|
||||
"bridgePlanGroup": "unknown"
|
||||
}
|
||||
}
|
||||
"""
|
||||
And bridge do not need to send heartbeat
|
||||
|
||||
|
||||
Scenario: Multiple-users on Bridge reported correctly
|
||||
Then bridge telemetry feature is enabled
|
||||
When the user logs in with username "[user:user1]" and password "password"
|
||||
Then it succeeds
|
||||
When the user logs in with username "[user:user2]" and password "password"
|
||||
Then it succeeds
|
||||
When the user logs in with username "[user:user3]" and password "password"
|
||||
Then it succeeds
|
||||
When bridge needs to explicitly send heartbeat
|
||||
Then bridge eventually sends the following heartbeat:
|
||||
"""
|
||||
{
|
||||
"MeasurementGroup": "bridge.any.usage",
|
||||
"Event": "bridge_heartbeat_new",
|
||||
"Values": {
|
||||
"NumberConnectedAccounts": 3,
|
||||
"rolloutPercentage": 1
|
||||
},
|
||||
"Dimensions": {
|
||||
"isAutoUpdateEnabled": "true",
|
||||
"isAutoStartEnabled": "true",
|
||||
"isBetaEnabled": "false",
|
||||
"isDohEnabled": "false",
|
||||
"usesSplitMode": "false",
|
||||
"useAllMail": "true",
|
||||
"useDefaultImapPort": "true",
|
||||
"useDefaultSmtpPort": "true",
|
||||
"useDefaultCacheLocation": "true",
|
||||
"useDefaultKeychain": "true",
|
||||
"isContactedByAppleNotes": "false",
|
||||
"imapConnectionMode": "starttls",
|
||||
"smtpConnectionMode": "starttls",
|
||||
"prevVersion": "0.0.0",
|
||||
"bridgePlanGroup": "unknown"
|
||||
}
|
||||
}
|
||||
"""
|
||||
And bridge do not need to send heartbeat
|
||||
|
||||
|
||||
Scenario: Send heartbeat explicitly - apple notes tried to connect
|
||||
Then bridge telemetry feature is enabled
|
||||
When the user logs in with username "[user:user1]" and password "password"
|
||||
Then it succeeds
|
||||
When user "[user:user1]" connects IMAP client "1"
|
||||
And IMAP client "1" announces its ID with name "Mac OS X Notes" and version "14.5"
|
||||
When bridge needs to explicitly send heartbeat
|
||||
Then bridge eventually sends the following heartbeat:
|
||||
"""
|
||||
{
|
||||
"MeasurementGroup": "bridge.any.usage",
|
||||
"Event": "bridge_heartbeat_new",
|
||||
"Values": {
|
||||
"NumberConnectedAccounts": 1,
|
||||
"rolloutPercentage": 1
|
||||
},
|
||||
"Dimensions": {
|
||||
"isAutoUpdateEnabled": "true",
|
||||
"isAutoStartEnabled": "true",
|
||||
"isBetaEnabled": "false",
|
||||
"isDohEnabled": "false",
|
||||
"usesSplitMode": "false",
|
||||
"useAllMail": "true",
|
||||
"useDefaultImapPort": "true",
|
||||
"useDefaultSmtpPort": "true",
|
||||
"useDefaultCacheLocation": "true",
|
||||
"useDefaultKeychain": "true",
|
||||
"isContactedByAppleNotes": "true",
|
||||
"imapConnectionMode": "starttls",
|
||||
"smtpConnectionMode": "starttls",
|
||||
"prevVersion": "0.0.0",
|
||||
"bridgePlanGroup": "unknown"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
@ -54,6 +54,10 @@ func (s *scenario) bridgeNeedsToSendHeartbeat() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *scenario) bridgeNeedsToSendExplicitHeartbeat() error {
|
||||
return s.t.heartbeat.SetLastHeartbeatSent(time.Now().Add(-24 * time.Hour))
|
||||
}
|
||||
|
||||
func (s *scenario) bridgeDoNotNeedToSendHeartbeat() error {
|
||||
last := s.t.heartbeat.GetLastHeartbeatSent()
|
||||
if isAnotherDay(last, time.Now()) {
|
||||
@ -73,7 +77,7 @@ func matchHeartbeat(have, want telemetry.HeartbeatData) error {
|
||||
}
|
||||
|
||||
// Ignore rollout number
|
||||
want.Dimensions.Rollout = have.Dimensions.Rollout
|
||||
want.Values.Rollout = have.Values.Rollout
|
||||
|
||||
if have != want {
|
||||
return fmt.Errorf("missing heartbeat: have %#v, want %#v", have, want)
|
||||
|
||||
@ -207,6 +207,8 @@ func (s *scenario) steps(ctx *godog.ScenarioContext) {
|
||||
// ==== TELEMETRY ====
|
||||
ctx.Step(`^bridge eventually sends the following heartbeat:$`, s.bridgeEventuallySendsTheFollowingHeartbeat)
|
||||
ctx.Step(`^bridge needs to send heartbeat`, s.bridgeNeedsToSendHeartbeat)
|
||||
ctx.Step(`^bridge needs to explicitly send heartbeat`, s.bridgeNeedsToSendExplicitHeartbeat)
|
||||
|
||||
ctx.Step(`^bridge do not need to send heartbeat`, s.bridgeDoNotNeedToSendHeartbeat)
|
||||
ctx.Step(`^heartbeat is not whitelisted`, s.heartbeatIsNotwhitelisted)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user