| 33 | | === URL TO ACCESS RESULTS === |
| 34 | | http://82.71.213.53/RESULTS |
| 35 | | |
| 36 | | === LOGIN DETAILS === |
| 37 | | |
| 38 | | ssh youraccount@82.71.213.53 |
| 39 | | |
| 40 | | Password: ***** |
| 41 | | |
| 42 | | === Location of Cron Job Automation file to run Test Framework: === |
| 43 | | |
| 44 | | /etc/cron.custom/testsuite |
| 45 | | |
| 46 | | * What this does currently : |
| 47 | | * Prepares Server |
| 48 | | * Pulls latest codes from web2py/web2py (update web2py) |
| 49 | | * Pulls latest codes from flavour/eden (update Eden) |
| 50 | | * Deletes prepopulated data |
| 51 | | * Loads all models |
| 52 | | * Fixes permissions of the web2py folder |
| 53 | | * Runs Automated Test Suite |
| 54 | | * Runs Smoke Tests |
| 55 | | * Runs Roles Tests |
| 56 | | |
| 57 | | === Edit cron times: === |
| 58 | | (Currently set to run Test Suite every 6 hours every day of every week of every month of every year) |
| 59 | | {{{#!sh |
| 60 | | crontab -e |
| 61 | | }}} |
| 62 | | |
| 63 | | === Location of Web2Py and Eden Directory === |
| 64 | | * web2py |
| 65 | | * /home/web2py |
| 66 | | * Eden |
| 67 | | * /home/web2py/applications/eden |
| 68 | | |
| 69 | | === Overall Restart === |
| 70 | | If 82.71.213.53 goes down with these errors: |
| 71 | | |
| 72 | | * Internal Error |
| 73 | | * Server Maintenance |
| 74 | | * Connection Timeout by every web browser |
| 75 | | * Unresolvable Ticket Error |
| 76 | | |
| 77 | | Simply type these services restart commands in consoles: |
| 78 | | |
| 79 | | * Server Reboot : |
| 80 | | {{{#!sh |
| 81 | | sudo /sbin/reboot |
| 82 | | }}} |
| 83 | | '''Note''' : There will be a downtime of a few minutes after you execute this command |
| 84 | | * Cherokee Restart |
| 85 | | {{{#!sh |
| 86 | | sudo /etc/init.d/cherokee restart |
| 87 | | }}} |
| 88 | | * Web2Py SSL Restart |
| 89 | | {{{#!sh |
| 90 | | sudo /etc/init.d/uwsgi start |
| 91 | | }}} |
| 92 | | |
| 93 | | === Start Test Suite Manually On the CI Server=== |
| 94 | | |
| 95 | | {{{#!sh |
| 96 | | sudo sh /etc/cron.custom/web2pystarter |
| 97 | | }}} |
| 98 | | Open another console then: |
| 99 | | {{{#!sh |
| 100 | | sudo sh /etc/cron.custom/testsuite |
| 101 | | }}} |
| 102 | | This first updates Eden and Web2py from Github, then runs the functional tests followed by smoke tests. |
| 103 | | |
| 104 | | To just run smoke tests: |
| 105 | | {{{#!sh |
| 106 | | cd /home/web2py |
| 107 | | xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_smoke/ --suite smoke --force-debug --link-depth 16 -V 4 |
| 108 | | }}} |
| 109 | | |
| 110 | | We also have an install of [SysAdmin/Jenkins Jenkins] which should ideally be configured to run this. |
| 111 | | ==== Shell Script to Start The Test Suite On The CI Server ==== |
| 112 | | |
| 113 | | Simply run this shell script to start Functional selenium test, followed by Smoke test and then finally the Role test. |
| 114 | | You can comment out the lines you don't want to run. |
| 115 | | * Save the Code given below in a file (say, named as startSuite) |
| 116 | | * Add Execution permission to the file |
| 117 | | * chmod +x /location/to/script/startSuite |
| 118 | | * Execute the shell script |
| 119 | | * sudo sh /location/to/script/startSuite |
| 120 | | |
| 121 | | {{{ |
| 122 | | #!div style="font-size: 80%" |
| 123 | | {{{#!sh |
| 124 | | #!/bin/sh |
| 125 | | ######## |
| 126 | | # Cron Script to run Sahana Eden Test Suite |
| 127 | | ######## |
| 128 | | #Server preparation |
| 129 | | sudo /etc/init.d/cherokee restart |
| 130 | | sudo /etc/init.d/uwsgi start |
| 131 | | |
| 132 | | # Pull latest codes from web2py/web2py (update web2py) |
| 133 | | cd /home/web2py |
| 134 | | sudo git stash |
| 135 | | sudo git pull upstream master |
| 136 | | |
| 137 | | # Pull latest codes from flavour/eden (update Eden) |
| 138 | | cd /home/web2py/applications/eden |
| 139 | | sudo git stash |
| 140 | | sudo git pull upstream master |
| 141 | | |
| 142 | | # Delete prepopulated data |
| 143 | | rm -f /home/web2py/applications/eden/databases/* |
| 144 | | |
| 145 | | # Re pre pop db and fix permissions |
| 146 | | cd /home/web2py |
| 147 | | python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py |
| 148 | | chown -R web2py /home/web2py |
| 149 | | |
| 150 | | # Run Automated Test Suite |
| 151 | | cd /home/web2py |
| 152 | | xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_automated/ -V 2 |
| 153 | | |
| 154 | | # Run Smoke Test (on linkdepth 16) |
| 155 | | cd /home/web2py |
| 156 | | xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --html-path /home/web2py/applications/eden/static/test_smoke/ --suite smoke --force-debug --link-depth 16 -V 3 |
| 157 | | |
| 158 | | # Run Roles Test |
| 159 | | cd /home/web2py |
| 160 | | xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A --suite roles --html-path /home/web2py/applications/eden/static/test_roles/ |
| 161 | | }}} |
| 162 | | }}} |
| 163 | | |
| 164 | | === Postgresql Instance Details for CI Server === |
| 165 | | |
| 166 | | '''Database name''': sahana |
| 167 | | |
| 168 | | '''Database user''': kunal |
| 169 | | |
| 170 | | '''Database user password''': eden |
| 171 | | |
| 172 | | '''Host''': localhost |
| 173 | | |
| 174 | | '''Port''': 5432 |
| 175 | | |
| 176 | | |
| 177 | | ==== How to Connect to Sahana Database from the console ==== |
| 178 | | {{{#!sh |
| 179 | | psql -d sahana -U kunal |
| 180 | | }}} |
| 181 | | |
| 182 | | ==== How to Restart Postgresql Server (You can give it a shot, if psql fails to connect) ==== |
| 183 | | {{{#!sh |
| 184 | | sudo su - postgres |
| 185 | | /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 & |
| 186 | | }}} |
| 187 | | |
| 188 | | === Other Useful Linux command sets === |
| 189 | | |
| 190 | | * '''Pre-populate database (any type of db)''' : |
| 191 | | {{{#!sh |
| 192 | | cd ~web2py |
| 193 | | sudo python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py |
| 194 | | }}} |
| 195 | | * '''chmod directory recursively (chmod everything inside dir with -R):''' |
| 196 | | {{{#!sh |
| 197 | | chmod -R 777 /home/web2py |
| 198 | | }}} |
| 199 | | * '''start web2py''' |
| 200 | | {{{#!sh |
| 201 | | cd ~web2py |
| 202 | | python web2py.py -a root |
| 203 | | }}} |
| 204 | | * '''reboot server''' |
| 205 | | {{{#!sh |
| 206 | | sudo /sbin/reboot |
| 207 | | }}} |
| 208 | | * '''Restart Cherokee''' |
| 209 | | {{{#!sh |
| 210 | | sudo /etc/init.d/cherokee restart |
| 211 | | }}} |
| 212 | | * '''Restart Web2Py SSL''' |
| 213 | | {{{#!sh |
| 214 | | sudo /etc/init.d/uwsgi start |
| 215 | | }}} |
| 216 | | * '''Recreate Sahana DB''' : |
| 217 | | {{{#!sh |
| 218 | | psql -U postgres -c "drop database sahana" |
| 219 | | psql -U postgres -c "create database sahana" |
| 220 | | psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE sahana to kunal" #Assuming kunal is the name of the postgresql username which will be used by Sahana Eden instance |
| 221 | | psql -d sahana -U kunal |
| 222 | | }}} |
| 223 | | * '''Setup Cron''' : |
| 224 | | {{{#!sh |
| 225 | | crontab -e |
| 226 | | }}} |
| 227 | | '''Note''' : You can refer to examples of crontab expressions here : http://code.google.com/p/ncrontab/wiki/CrontabExamples |
| 228 | | * '''start Window based applications (x11)''': |
| 229 | | * If the GUI window of the application is of no intrest to you |
| 230 | | {{{#!sh |
| 231 | | xvfb-run -a *test commands here* |
| 232 | | }}} |
| 233 | | For example : |
| 234 | | {{{#!sh |
| 235 | | xvfb-run -a python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A -V 2 |
| 236 | | }}} |
| 237 | | '''Note''': Xvfb basically makes a virtual display which isn't displayed anywhere. Xserver itself actually requires a real display |
| 238 | | * If you want to see the GUI interface of the application |
| 239 | | * If your machine you use to ssh into the server, has X Server installed, then you can access the GUI window by using the -X flag when loggin into the server |
| 240 | | {{{#!sh |
| 241 | | ssh -X youraccount@82.71.213.53 |
| 242 | | }}} |
| 243 | | And now, if you simply execute any application which has a Xserver attached to it, it will be displayed on your screen. |
| | 72 | Setup Notes & Discussions (to be ported to Wiki): |
| | 73 | * https://docs.google.com/document/d/1T29cF3kkK4lIAVdiATfE8a-tLm_Tyh3_dIh6FJWY7sU/edit |