Files
Joel Brobecker 4219203e35 update nearly all testcases to add hooks.filer-email to test repo config
This updates all the testcases where the hooks.filer-email is implicit,
so as to now be explicitly part of the test repository's configuration.

While we're making this change, we take this opportunity to use
a bogus email address instead of using an email address in one of
AdaCore's domains.

In most testcases, the test repositories' configuration was adjusted
using the following shell script:

    | #/usr/bin/env zsh
    |
    | test_dir=$1
    |
    | if [ ! -d $test_dir ]; then
    |    exit 1
    | fi
    |
    | cd $test_dir
    | if [ ! -f hooks_config ]; then
    |    exit 1
    | fi
    |
    | ../../bin/unpack-test-repos
    | (
    |   cd repo
    |   current_branch=`git rev-parse --abbrev-ref HEAD`
    |
    |   git fetch origin refs/meta/config
    |   git co FETCH_HEAD
    |   git config -f project.config hooks.filer-email 'filer@example.com'
    |   git ci -a -m 'project.config: add hooks.filer-email'
    |   git push origin HEAD:refs/meta/config
    |
    |   git co $current_branch
    | ) >/dev/null 2>&1
    | ../../bin/pack-test-repos

And the test.py scripts have then been adjusted with the following perl
one-liner:

    $ perl -pi -e "s/file-ci\@gnat.com/filer\@example.com/g" */test.py

A number of testscases (13, to be exact), had to be adjusted manually,
for a couple of reasons:

  - The test repository had a branch that the test tries to push to
    the refs/meta/config reference -- that push was being rejected
    because it was no longer up to date (non-fast-forward update).
    The branch was rebased, which changed the SHA1-s, and the diffs.

  - The test was creating a commit on the fly that changes the
    project.config file in the refs/meta/config reference. For those,
    the change to make was to simply update the hooks_config file
    in that test.

Change-Id: I626a29f77c3c2bb5dc13ebd2f11542a6fa066930
TN: T512-052
2020-06-15 11:32:45 -07:00

61 lines
1.8 KiB
Python

from support import *
class TestRun(TestCase):
def test_push_commit_on_master(self):
"""Try pushing one single-file commit on master.
"""
cd ('%s/repo' % TEST_DIR)
# Push master to the `origin' remote. The delta should be one
# commit with one file being modified.
p = Run('git push origin master'.split())
expected_out = """\
remote: *** cvs_check: `repo' < `a'
remote: DEBUG: Content-Type: text/plain; charset="us-ascii"
remote: MIME-Version: 1.0
remote: Content-Transfer-Encoding: 7bit
remote: From: Test Suite <testsuite@adacore.com>
remote: To: git-hooks-ci@example.com
remote: Bcc: filer@example.com
remote: Subject: [repo] Updated a.
remote: X-Act-Checkin: repo
remote: X-Git-Author: Joel Brobecker <brobecker@adacore.com>
remote: X-Git-Refname: refs/heads/master
remote: X-Git-Oldrev: d065089ff184d97934c010ccd0e7e8ed94cb7165
remote: X-Git-Newrev: a60540361d47901d3fe254271779f380d94645f7
remote:
remote: commit a60540361d47901d3fe254271779f380d94645f7
remote: Author: Joel Brobecker <brobecker@adacore.com>
remote: Date: Fri Apr 27 13:08:29 2012 -0700
remote:
remote: Updated a.
remote:
remote: Just added a little bit of text inside file a.
remote: Thought about doing something else, but not really necessary.
remote:
remote: Diff:
remote: ---
remote: a | 4 +++-
remote: 1 file changed, 3 insertions(+), 1 deletion(-)
remote:
remote: diff --git a/a b/a
remote: index 01d0f12..a90d851 100644
remote: --- a/a
remote: +++ b/a
remote: @@ -1,3 +1,5 @@
remote: Some file.
remote: -Second line.
remote: +Second line, in the middle.
remote: +In the middle too!
remote: Third line.
remote: +
To ../bare/repo.git
d065089..a605403 master -> master
"""
self.assertEqual(p.status, 0, p.image)
self.assertRunOutputEqual(p, expected_out)
if __name__ == '__main__':
runtests()