Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 1 | # Chromium Updater Test Plan |
| 2 | |
| 3 | This is the test plan for |
| 4 | [Chromium Updater](https://source.chromium.org/chromium/chromium/src/+/main:chrome/updater/). |
| 5 | |
| 6 | It should be read in conjunction with the |
| 7 | [functional specification](functional_spec.md) to assess functional coverage. |
| 8 | |
| 9 | ## Bots & Test Dimensions |
| 10 | The updater is covered by CQ and CI bots; the |
| 11 | [CI console](https://ci.chromium.org/p/chromium/g/chromium.updater/console) |
| 12 | shows the bots on which updater tests are run. |
| 13 | |
| 14 | Except where noted, the updater's behavior is consistent across platforms and |
| 15 | is tested on macOS and Windows. |
| 16 | |
| 17 | The updater may run at system-wide or per-user scope. The `updater_tests` |
| 18 | binary contains all user-scope tests, and the `updater_tests_system` binary |
| 19 | contains all system-scope tests. Except where otherwise noted, tests appear in |
| 20 | both binaries. |
| 21 | |
| 22 | On macOS, `updater_tests_system` requires passwordless `sudo` to operate. In |
| 23 | local tests, this can usually be achieved by running `sudo echo;` before |
| 24 | running the tests. Updater bots running `updater_tests_system` have specifically |
| 25 | had passwordless sudo enabled. |
| 26 | |
| 27 | On Windows, both UAC-enabled and normal Chromium configurations are tested. |
| 28 | |
| 29 | ## Test Binaries |
| 30 | To secure updates, the updater contains pinned public keys and update URLs. |
| 31 | This presents a challenge for testing, since the corresponding private keys |
| 32 | cannot be exposed to test infrastructure. The build system produces both a real |
| 33 | updater binary for distribution, and a "test" binary that is similar but with |
| 34 | extra test hooks compiled in. All tests use the test binary. |
| 35 | |
| 36 | ## Old Binaries |
| 37 | The updater updates itself. Covering this ability with tests presents a unique |
| 38 | challenge, since multiple versions of the updater have to be available to the |
| 39 | test. To support such tests, old versions of the updater are available in CIPD |
Joanna Wang | 75ad014 | 2024-06-11 16:01:58 | [diff] [blame] | 40 | and brought into the tree using `//DEPS` at `//third_party/updater/*/cipd`. |
Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 41 | |
| 42 | ## Unit Testing |
| 43 | Much of the functionality of the updater is covered by unit testing. Unit tests |
| 44 | are defined in files ending in `(module)_test.*` in the source tree. |
| 45 | |
| 46 | ## Integration Testing |
| 47 | Integration tests cover the end-to-end behavior of the updater. They typically |
| 48 | rely on installing the updater, manipulating it, asserting on a result, and then |
| 49 | uninstalling the updater. |
| 50 | |
| 51 | Because the integration tests actually install the updater, they usually don't |
| 52 | work with (and therefore aren't compiled into) `is_component_build=true` builds, |
| 53 | since component builds are generally not portable outside of the build output |
| 54 | directory. |
| 55 | |
| 56 | Care must be taken when running the integration tests on a developer system, |
| 57 | especially in the `is_chrome_branded=true` context, since the tests install and |
| 58 | uninstall the updater, and attempt to leave the system clean (i.e. without any |
| 59 | GoogleUpdater installation). This may prevent the developer's copy of Google |
| 60 | Chrome (or other software) from being kept up to date. |
| 61 | |
| 62 | Integration tests for system-scoped updaters frequently have to perform actions |
| 63 | at high privilege. This is accomplished by using an out-of-process test helper |
| 64 | binary (`updater_integration_tests_helper`) that runs at high privilege |
| 65 | (elevated via `sudo` on macOS). The helper binary run a gtest main so that the |
| 66 | commands it handles can use gtest asserts. |
| 67 | |
| 68 | ### Installation |
S. Ganesh | 5e8cfff | 2022-11-23 13:30:57 | [diff] [blame] | 69 | IntegrationTest.Install tests that the updater can be installed on a clean OS, |
| 70 | that it is immediately active after installation, and then can be cleanly |
| 71 | uninstalled. |
Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 72 | |
S. Ganesh | 1b1e771 | 2022-12-15 23:57:38 | [diff] [blame] | 73 | IntegrationTest.Handoff tests that the updater can be installed on a clean OS, |
| 74 | that it can install an app via a "/handoff" command line, and then can be |
| 75 | cleanly uninstalled. |
| 76 | |
Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 77 | Overinstall cases are tested by IntegrationTest.OverinstallWorking and |
| 78 | IntegrationTest.OverinstallBroken, to ensure that the updater can be installed |
| 79 | on an unclean OS, and as a post-condition of installation, the system has a |
| 80 | working and active updater (although it may not be the version just installed). |
| 81 | |
| 82 | IntegrationTest.QualifyUpdater tests that the updater will perform its self- |
| 83 | test and then activate itself after installation/update, if an older working |
| 84 | instance of the updater is already present. |
| 85 | |
| 86 | IntegrationTest.MigrateLegacyUpdater tests that the updater will import data |
| 87 | from legacy updaters (such as Omaha 3 or Keystone) when activating. |
| 88 | |
| 89 | IntegrationTest.RecoveryNoUpdater tests that the recovery component |
| 90 | implementation can install and activate the updater on a machine where no |
| 91 | updater exists. |
| 92 | |
| 93 | IntegrationTest.OfflineInstall, IntegrationTest.SilentOfflineInstall, and |
S. Ganesh | 5e8cfff | 2022-11-23 13:30:57 | [diff] [blame] | 94 | IntegrationTest.LegacySilentOfflineInstall test that the updater can handle |
Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 95 | handoffs from offline installers. *Windows Only* |
| 96 | |
| 97 | ### Updates |
| 98 | IntegrationTest.SelfUpdate tests that this version of the updater can run a |
| 99 | fake update on itself. |
| 100 | |
| 101 | IntegrationTest.SelfUpdateFromOldReal tests that an older version of the updater |
| 102 | can successfully update to this version of the updater, and that this version |
| 103 | qualifies itself and activates. |
| 104 | |
| 105 | IntegrationTest.UpdateApp tests that the updater can run an update on a |
| 106 | registered app. |
| 107 | |
| 108 | IntegrationTest.SameVersionUpdate tests that the updater can perform a same- |
| 109 | versioned over-install of an application (such as in an installer context). |
| 110 | |
| 111 | IntegrationTest.InstallDataIndex tests that the updater can handle an install |
| 112 | data index and transmit it to the server as part of the install request. |
| 113 | |
| 114 | IntegrationTest.ReportsActive tests that the updater transmits active telemetry |
| 115 | for apps. |
| 116 | |
Joshua Pawlicki | cf7affe | 2022-11-03 19:04:35 | [diff] [blame] | 117 | IntegrationTest.RotateLog tests that the updater rotates its log file after the |
| 118 | log file grows to a sufficient size. |
| 119 | |
Joshua Pawlicki | 4a1d3f3 | 2022-10-28 16:43:58 | [diff] [blame] | 120 | IntegrationTest.ForceInstallApp tests that the updater will install an app, |
| 121 | when provided group policies that force installation of that app. *Windows Only* |
| 122 | |
| 123 | IntegrationTest.MultipleWakesOneNetRequest tests that even if the updater wakes |
| 124 | often, it will only check for updates once (within the timeline of the test). |
| 125 | |
| 126 | IntegrationTest.MultipleUpdateAllsMultipleNetRequests tests that if the updater |
| 127 | receives multiple commands to immediately check for updates, it does so (in |
| 128 | contrast to multiple wake commands). |
| 129 | |
| 130 | IntegrationTest.LegacyUpdate3Web tests that the updater can be exercised using |
| 131 | the legacy COM APIs. *Windows Only* |
| 132 | |
| 133 | IntegrationTest.UpdateServiceStress tests the IPC mechanisms to build confidence |
| 134 | that the updater can be started frequently. |
| 135 | |
| 136 | ### Services |
| 137 | IntegrationTest.LegacyProcessLauncher tests that the updater's process launcher |
| 138 | feature correctly launches a process when commanded to. *Windows Only* |
| 139 | |
| 140 | IntegrationTest.LegacyAppCommandWeb tests that the updater, when set up with |
| 141 | an appropriate legacy app command and then commanded to run it, will do so. |
| 142 | *Windows Only* |
| 143 | |
| 144 | IntegrationTest.LegacyPolicyStatus tests that the updater reports its policies |
| 145 | using the legacy COM APIs. *Windows Only* |
| 146 | |
| 147 | IntegrationTest.UnregisterUnownedApp tests that the updater does not try to |
| 148 | update applications owned by other users or scopes. *macOS Only* |
| 149 | |
| 150 | ### Uninstallation |
| 151 | IntegrationTest.SelfUninstallOutdatedUpdater tests that an old version of the |
| 152 | updater removes itself after a new version of the updater has become active. |
| 153 | |
| 154 | IntegrationTest.UninstallCmdLine tests that running the updater's uninstall |
| 155 | command uninstalls the updater only if the updater has been present for a |
| 156 | minimum number of startups, in the case that no app has ever been installed. |
| 157 | *Windows Only* |
| 158 | |
| 159 | IntegrationTest.UnregisterUninstalledApp tests that if an app has been |
| 160 | uninstalled, the updater removes it from further update checks. |
| 161 | |
| 162 | IntegrationTest.UninstallIfMaxServerWakesBeforeRegistrationExceeded tests that |
| 163 | the updater uninstalls itself if it has been present on the machine for a |
| 164 | while but no other apps have been installed. |
| 165 | |
| 166 | IntegrationTest.UninstallUpdaterWhenAllAppsUninstalled tests that the updater |
| 167 | uninstalls itself when it no longer has other apps to keep up to date. |
| 168 | |
| 169 | ### Associated Tools |
| 170 | Associated tools should be covered by unit tests. |
| 171 | |
| 172 | ## Manual Testing |
| 173 | No routine manual testing is planned. |