User Tools

Site Tools


newdevs:git:test

New Developers Working Group

Git for Windows

Using Git to Test Patches

1. Get the Commit Hash

First, you will need to identify the unique commit ID (hash) of the patch you wish to test. This is most easily found by clicking on a link in the related launchpad bug. Once there, copy the first 7+ characters from the unique commit code.

2. Load the Patch to Your Test Server

The next steps will be somewhat different depending on whether you have direct access to a test server that has Git installed or whether you have file access via WinSCP or another file transfer program.

Option A: Testing When You Have File Access to Your Test Server

A1. Update Your Local Repository

  1. Open Git Bash on your computer.
  2. Navigate into your Evergreen repository.
  3. If the main branch isn't currently checked out, check it out: git checkout main
  4. Make sure your local repository is current: git pull

A2. Create a Testing Branch

  1. Create and checkout a local testing branch: git checkout -b lp12345_branch_name
    • This branch does not have to have the same name as the branch you will be testing, but it makes it easier to keep track of.
  2. Pull changes into the testing branch using the unique commit id: git cherry-pick 7ab7281f5
    • If you receive an error while cherry picking, you can stop it: git cherry-pick –abort
    • If the branch has multiple commits, you can cherry-pick them one at a time (oldest to newest) or you can cherry-pick a range of commits at once (oldest to newest): git cherry-pick 7ab7281f5^..8lgls9a34

A3. Upload Changed Files

Using WinSCP (or your other FTP-style program), transfer each of the changed files in the patch from your local repository to the related 'installed' locations on the server. (See https://wiki.evergreen-ils.org/doku.php?id=newdevs:landscape:tree

Option B: Testing When You Have Direct Git Access to Your Test Server

Note: Your test server does not need to have an SSH key if you are just pulling branches for testing. Instead, you can set up your connection to the remote working repo as read-only: git://git.evergreen-ils.org:working/Evergreen.git

B1. Update Your Repository

  1. Open Git Bash on the server as the root user.
  2. Navigate into your Evergreen repository.
  3. If the main branch isn't currently checked out, check it out: git checkout main
  4. Make sure your local repository is current: git pull

B2. Create a Testing Branch

  1. Create and checkout a local testing branch: git checkout -b lp12345_branch_name
    • This branch does not have to have the same name as the branch you will be testing, but it makes it easier to keep track of.
  2. Pull changes into the testing branch using the unique commit id: git cherry-pick 7ab7281f5
    • If you receive an error while cherry picking, you can stop it: git cherry-pick –abort

B3. Upload Changed Files

Copy each file to the 'installed' directory. For example:

cp Open-ILS/src/templates/header.tt2 /openils/var/templates/header.tt2

3. Restart Services as Needed

If you are only testing changes to template (tt2) files or basic javascript files, then just clearing the browser cache may be sufficient.

If you are testing changes to configuration files, Perl files, or javascript files, you may also need to restart various services (these instructions require command line access to the root user on the test server).

To restart OpenSRF (this restarts Evergreen):

su - opensrf -c "bash -i -c '/openils/bin/osrf_control --localhost --restart-all'"

To restart Autogen (this refreshes the org unit tree, incorporates field mapper changes, etc.):

su - opensrf -c /openils/bin/autogen.sh

To restart Apache and WebSockets (the underlying servers/protocols):

systemctl restart apache2 websocketd-osrf

If your test server is running the NGINX http/proxy server, you can also restart that:

systemctl restart nginx

If you are testing very large changes, or changes that modify the database, you may need to rebuild the Evergreen installation. This requires significant Linux knowledge to do, and instructions are located at: https://evergreen-ils.org/documentation/install/README_3_3.html

4. Test

Test everything thoroughly to be sure it solves the problem that the developer wanted to solve. Be sure to test any other related pages/features to be sure that the new changes do not break any existing functionality.

5. Create a Sign-Off Branch

If testing is not successful, update the launchpad bug report with details.

If testing is successful, acknowledge it by adding a sign-off branch.

newdevs/git/test.txt · Last modified: 2023/06/01 11:58 by gmcharlton

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.