| 1 | [[PageOutline]] |
| 2 | = Testing BOINC software = |
| 3 | |
| 4 | Our options for development workflow |
| 5 | and release management depend on our ability to test. |
| 6 | This is a summary of what needs to be tested, |
| 7 | and the existing and prospective ways of doing it. |
| 8 | |
| 9 | Terminology: a branch is "stable" if it's been throughly tested, |
| 10 | i.e. there is evidence that most features work on most supported platforms. |
| 11 | "Unstable" means there isn't such evidence. |
| 12 | "Most" is something like 90%. 100% is impossible. |
| 13 | |
| 14 | == Client software == |
| 15 | |
| 16 | The client software is feature-rich, and runs on many platforms and configurations. |
| 17 | In the early days of BOINC we realized that developers could not adequately test the client software. |
| 18 | We also realized that active reporting is needed: |
| 19 | an absence of bug reports doesn't mean an absence of bugs. |
| 20 | So we created a testing and release system with two related parts: |
| 21 | |
| 22 | * An [https://boinc.berkeley.edu/alpha/ Alpha test project] where a large pool of volunteers, |
| 23 | having all different types of computers, GPU, configurations, etc., |
| 24 | could test new versions of the client software, and |
| 25 | * A [https://boinc.berkeley.edu/alpha/test_matrix.php comprehensive list of test cases]. |
| 26 | * A web-based interface by which testers report results. |
| 27 | * A web-based interface for viewing test results. |
| 28 | * A policy for approving a version: |
| 29 | It must get at least 5 "no problems found" reports for each sub-platform |
| 30 | (e.g. Win7, Win10, Mac 10.11, Mac 10.12, Android). |
| 31 | |
| 32 | * A [https://boinc.berkeley.edu/trac/wiki/AdminReleaseManagement release management policy] |
| 33 | that works as follows: |
| 34 | * Master is unstable. |
| 35 | * When significant new features have been added to master, create a new "client release branch". |
| 36 | * Have the Alpha test project test this branch. |
| 37 | * Fix bugs and repeat. |
| 38 | * When done, the branch is stable; make it the new public release. |
| 39 | * Thereafter, only bug fixes are allowed in the branch. |
| 40 | Retest with Alpha test, and release new minor versions as needed. |
| 41 | |
| 42 | Fixing bugs that occur on volunteer hosts can be hard. |
| 43 | To facilitate it, I built a |
| 44 | [http://boinc.berkeley.edu/dev/sim_web.php Client emulator] |
| 45 | that lets me recreate volunteer scenarios in a place |
| 46 | where I can use a debugger. |
| 47 | |
| 48 | This has worked extremely well. |
| 49 | Over the years we have simultaneously |
| 50 | * developed the client at a very fast pace |
| 51 | * done a sequence of multi-platform client releases that have been free of major defects. |
| 52 | |
| 53 | We did this with minimal staff overhead (a small fraction of me and Rom). |
| 54 | Leveraging volunteer testers was critical. |
| 55 | |
| 56 | == Server software == |
| 57 | |
| 58 | This includes the scheduler, transitioner and other back-end programs, |
| 59 | make_project, create_work, start script, |
| 60 | remote file management, and remote job submission. |
| 61 | |
| 62 | Testing the server software is hard because: |
| 63 | |
| 64 | * Basic functionality is complex, e.g.: |
| 65 | * New results are created when others time out |
| 66 | * A workunit errors out when too many results have been created |
| 67 | * For a given work request, the appropriate number of jobs is sent |
| 68 | and the appropriate app versions are used |
| 69 | * File deletion and DB purging eventually clean up everything |
| 70 | It's not realistic to expect a developer to test all of these. |
| 71 | |
| 72 | * Realistic testing cannot be done with a single client. |
| 73 | It must involve a diverse population of clients, some of the unreliable or malicious. |
| 74 | (or a simulation of such a population). |
| 75 | |
| 76 | * The server software has hundreds of options and features |
| 77 | (to name a few: job assignment, job size matching, plan classes, trickle messages, |
| 78 | jobs with big data files, non-CPU-intensive apps, and so on) |
| 79 | Many of them are there to support a particular project, and require that project's context |
| 80 | (project-specific application, validators, assimilators etc.) in order to test. |
| 81 | |
| 82 | * Server functionality can be central (1 server) or distributed. |
| 83 | Testing must cover all cases. |
| 84 | |
| 85 | * The server software must work with various versions of dependent software |
| 86 | (MySQL, PHP, Linux, VirtualBox). |
| 87 | |
| 88 | * Unintended consequences: a change in one place can introduce |
| 89 | bugs in (unpredictable) other places. |
| 90 | When you change anything, you have to test everything. |
| 91 | |
| 92 | The bottom line is: |
| 93 | |
| 94 | '''Developer, by themselves, are unable to test the server software'''. |
| 95 | |
| 96 | And in fact |
| 97 | |
| 98 | '''we currently have no way of testing server software'''. |
| 99 | |
| 100 | Thus |
| 101 | |
| 102 | '''The server software in the master branch is inherently unstable'''. |
| 103 | |
| 104 | === Current === |
| 105 | |
| 106 | I'm the main developer of server software. |
| 107 | Before I commit server software to master I deploy it on a minimal test project |
| 108 | and make sure whatever I changed works, |
| 109 | and that basic functionality (creating and sending jobs) works. |
| 110 | |
| 111 | This tests only a tiny fraction of the server functionality. |
| 112 | A change could pass this test but cause serious problems |
| 113 | that appear only after hours or days. |
| 114 | |
| 115 | Eventually I test master in SETI@home beta, and then in SETI@home. |
| 116 | Sometimes there is a delay of a month or two in doing this. |
| 117 | |
| 118 | There has never been a stable release of the server software. |
| 119 | In practice master is bug-free most of the time, but there is no guarantee of this. |
| 120 | |
| 121 | === Proposal === |
| 122 | |
| 123 | Most large projects maintain separate test projects (e.g. SETI@home beta). |
| 124 | I propose that these be used to test server software, |
| 125 | the same way we use volunteer Alpha testers to test the client software. |
| 126 | To test a branch, projects will deploy it in their beta test projects, |
| 127 | and test the features they use, with their apps, |
| 128 | and will report results using a web-based system |
| 129 | (we could use the Alpha-test system for this). |
| 130 | |
| 131 | We should maintain '''server release branches''', similar to client release branches. |
| 132 | When significant new features have been added to master, |
| 133 | create a new candidate release branch. |
| 134 | Deploy to beta projects. |
| 135 | Fix bugs as needed; repeat. |
| 136 | When done, that branch is stable; |
| 137 | make it the public release branch. |
| 138 | |
| 139 | Server release branches should, in fact, be a stable version of everything |
| 140 | that a project needs: server, web, API, wrappers. |
| 141 | NOTE: They are not stable for client software. |
| 142 | |
| 143 | This will also encourage existing projects to merge project-specific changes |
| 144 | into BOINC (as e.g. SETI@home does) , so that they are able to use current server software. |
| 145 | |
| 146 | Fixing bugs that occur in a particular project's beta test can be difficult. |
| 147 | Sometimes I've added logging output. |
| 148 | As a last resort projects have let me log into their servers. |
| 149 | Maybe we can do something analogous to the Client Emulator for server code. |
| 150 | |
| 151 | === Automated testing? === |
| 152 | |
| 153 | We could create a framework for automated testing of server software. |
| 154 | I started doing this a long time ago, and didn't make much progress. |
| 155 | More recently, I (with Trilce Estrada) added a mechanism for simulating a project |
| 156 | against a dynamic population of clients. |
| 157 | This could be used as a basis for automated testing. |
| 158 | But it would be a lot of work - like 6 FTE months. |
| 159 | |
| 160 | I'm skeptical about the feasability of this. |
| 161 | The effort needed to construct and maintain an automated test for a complex feature |
| 162 | can exceed that for the feature itself. |
| 163 | I spent a lot of time making a system for testing basic features. |
| 164 | I never found any bugs in BOINC, just a never-ending sequence of bugs in the testing system. |
| 165 | |
| 166 | If we were to create such a system, and made it available to developers, |
| 167 | we could use it for testing changes to master, |
| 168 | at which point master would be stable. |
| 169 | This is the only way that master can be stable; |
| 170 | I don't think we can use beta-test projects for individual developer changes. |
| 171 | |
| 172 | == Web software == |
| 173 | |
| 174 | This is the PHP code that implements project web site features such as forums, leader boards, etc. |
| 175 | |
| 176 | As with server software, the web code is feature-rich, |
| 177 | and can't be thoroughly tested by a single developer. |
| 178 | |
| 179 | === Current === |
| 180 | |
| 181 | I test changes on my test project before commiting to master. |
| 182 | Then I deploy changes to SETI@home, where the changes are seen by thousands of people. |
| 183 | Any problems are reported to me by Jord, and I fix them quickly. |
| 184 | This works well, though there are short periods when master has bugs. |
| 185 | |
| 186 | === Proposal === |
| 187 | |
| 188 | Although the two are mostly independent, |
| 189 | we should use the same approach for web software as for server software: |
| 190 | test it, using beta-test projects, in the server stable branch. |
| 191 | |
| 192 | We should also explore tools for syntax-checking and security testing, |
| 193 | and integrate them into the CI process on master. |
| 194 | |
| 195 | == App API software and wrappers == |
| 196 | |
| 197 | These are feature-rich, and many of the features are used only by |
| 198 | specific applications that are not available to developers. |
| 199 | So it's not feasible for developers to test them. |
| 200 | |
| 201 | We should test these using beta-test projects, as for server software. |