git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
To: git@vger.kernel.org
Cc: Matthieu.Moy@imag.fr, simon.cathebras@ensimag.imag.fr,
	charles.roussel@ensimag.imag.fr, Julien.Khayat@ensimag.imag.fr,
	Simon.Perrat@ensimag.imag.fr,
	Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
Subject: [PATCH 1/2] FIX: t9360. NEW test t9361 for git pull and git push
Date: Thu, 31 May 2012 20:13:11 +0200	[thread overview]
Message-ID: <1338487992-305-1-git-send-email-guillaume.sasdy@ensimag.imag.fr> (raw)
In-Reply-To: <4FC64B0C.6070507@ensimag.imag.fr>

t9360: change the description of the test. Test git clone
t9361: Test git pull (add page, edit page, delete page) and git push on simple test cases (add file, edit file, delete file).
---
 t/t9360-git-mediawiki.sh |   4 +-
 t/t9361-git-mediawiki.sh | 156 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 158 insertions(+), 2 deletions(-)
 create mode 100755 t/t9361-git-mediawiki.sh

diff --git a/t/t9360-git-mediawiki.sh b/t/t9360-git-mediawiki.sh
index 8de56c5..57e05d8 100755
--- a/t/t9360-git-mediawiki.sh
+++ b/t/t9360-git-mediawiki.sh
@@ -12,7 +12,7 @@
 
 # tests for git-remote-mediawiki
 
-test_description='Test the Git Mediawiki remote helper'
+test_description='Test the Git Mediawiki remote helper: git clone'
 
 . ./test-gitmw-lib.sh
 . ./test-lib.sh
@@ -36,7 +36,7 @@ then
 fi
 
 test_expect_success 'git clone works with page added' '
-	cmd_reset &&
+	wiki_reset &&
 	wiki_editpage foo "hello_world" false &&
 	wiki_editpage bar "hi everybody !" false &&
 	git clone mediawiki::http://localhost/wiki mw_dir &&
diff --git a/t/t9361-git-mediawiki.sh b/t/t9361-git-mediawiki.sh
new file mode 100755
index 0000000..9dd7274
--- /dev/null
+++ b/t/t9361-git-mediawiki.sh
@@ -0,0 +1,156 @@
+#!/bin/sh
+#
+# Copyright (C) 2012
+#     Charles Roussel <charles.roussel@ensimag.imag.fr>
+#     Simon Cathebras <simon.cathebras@ensimag.imag.fr>
+#     Julien Khayat <julien.khayat@ensimag.imag.fr>
+#     Guillaume Sasdy <guillaume.sasdy@ensimag.imag.fr>
+#     Simon Perrat <simon.perrat@ensimag.imag.fr>
+#     Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
+#
+# License: GPL v2 or later
+
+# tests for git-remote-mediawiki
+
+test_description='Test the Git Mediawiki remote helper: git push and git pull simple test cases'
+
+. ./test-gitmw-lib.sh
+. ./test-lib.sh
+
+if ! test_have_prereq PERL
+then
+	skip_all='skipping gateway git-mw tests, perl not available'
+	test_done
+fi
+
+if [ ! -f /$GIT_BUILD_DIR/git-remote-mediawiki ];
+then
+	skip_all='skipping gateway git-mw tests, no remote mediawiki for git found'
+	test_done
+fi
+
+if [ ! -d "$WIKI_DIR_INST/$WIKI_DIR_NAME" ] ;
+then
+	skip_all='skipping gateway git-mw tests, no mediawiki found'
+	test_done
+fi
+
+# Create a new file foo.mw in a freshly cloned wiki. Commit and push
+# this file and then check that all files of the repository are similar to
+# the wiki pages.
+test_expect_success 'git push works after adding a file .mw' "
+        wiki_reset &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_getallpage ref_page &&
+
+        cd mw_dir &&
+        test ! -f foo.mw && # foo.mw should not exist after wiki_reset &&
+        touch foo.mw &&
+        echo \"hello world\" >> foo.mw &&
+        git add foo.mw &&
+        git commit -m \"foo\" &&
+        git push &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Create a new page Foo in an empty wiki. Clone the wiki and edit
+# the file foo.mw corresponding to the page Foo. Commit and push
+# then check that all files of the repository are similar to the wiki
+# pages.
+test_expect_success 'git push works after editing a file .mw' "
+        # clone an empty wiki and add a Foo page
+        wiki_reset &&
+        wiki_editpage \"foo\" \"page just created before the git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        cd mw_dir &&
+        echo \"new line added in the file foo.mw\" >> Foo.mw &&
+        git commit -am \"edit file foo.mw\" &&
+        git push &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Remove the corresponding file from the
+# repository. Check that the wiki page has been actually removed.
+test_expect_failure 'git push works after deleting a file' "
+        wiki_reset &&
+        wiki_editpage foo \"wiki page added before git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        cd mw_dir &&
+        git rm Foo.mw &&
+        git commit -am \"git rm delete the wiki page Foo.mw\" &&
+        git push &&
+        cd .. &&
+
+        rm -rf mw_dir &&
+        test ! wiki_page_exist Foo
+"
+
+# Clone an empty wiki. Add a page on the wiki and pull. Check 
+# all files of the repository are similar to the wiki pages.
+test_expect_success 'git pull works after adding a new wiki page' "
+        wiki_reset &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage foo \"page just created after the git clone\" false &&
+
+        cd mw_dir &&
+        git pull &&
+        cd .. &&
+
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page &&
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Edit the page foo on the wiki and pull.
+# Check that all files of the repository are similar to the wiki pages.
+test_expect_success 'git pull works after editing a wiki page' "
+        wiki_reset &&
+        wiki_editpage foo \"page just created before the git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+        wiki_editpage foo \"new line added on the wiki\" true &&
+
+        cd mw_dir &&
+        git pull &&
+        cd .. &&
+       
+        rm -rf ref_page &&
+        wiki_getallpage ref_page &&
+        git_content mw_dir ref_page &&
+        rm -rf ref_page
+        rm -rf mw_dir
+"
+
+# Clone a wiki with a page Foo. Remove the wiki page and pull.
+# Check that the corresponding file in the repository has been actually removed.
+test_expect_failure 'git pull works after deleting a wiki page' "
+        wiki_reset &&
+        wiki_editpage foo \"wiki page added before git clone\" false &&
+        git clone mediawiki::http://$SERVER_ADDR/$WIKI_DIR_NAME mw_dir &&
+
+        cd mw_dir &&
+        wiki_delete_page foo
+        git pull &&
+        test ! -f Foo.mw &&
+        cd .. &&
+
+        rm -rf mw_dir
+"
+
+test_done
+
-- 
1.7.10.2.568.g4c26a3a

  parent reply	other threads:[~2012-05-31 18:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 16:30 [PATCH/RFC]Test environment for Git-MediaWiki Simon.Cathebras
2012-05-30 17:04 ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Simon Cathebras
2012-05-30 17:04   ` [PATCH 2/3] Test environment of git-remote-mw Simon Cathebras
2012-05-31  7:17     ` Matthieu Moy
2012-06-01  8:53       ` Simon.Cathebras
2012-06-01  9:02         ` Matthieu Moy
2012-06-01  9:21           ` Matthieu Moy
2012-05-30 17:04   ` [PATCH 3/3] Tests file for git-remote-mediawiki Simon Cathebras
2012-05-31  7:19   ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Matthieu Moy
2012-05-31 18:13 ` Guillaume Sasdy [this message]
2012-05-31 18:13   ` [PATCH 2/2] FIX: Syntax of shell and perl scripts and posix compliant Guillaume Sasdy
2012-05-31 18:16 ` [PATCH] " Guillaume Sasdy
2012-05-31 18:27 ` Guillaume Sasdy
2012-05-31 18:31 ` [PATCH 1/3] FIX: cmd_* moved to wiki_* in test-gitmw-lib.sh and other files Guillaume Sasdy
2012-06-01 10:41 ` [PATCH 1/3] Script to install, delete and clear a MediaWiki Guillaume Sasdy
2012-06-01 10:41   ` [PATCH 2/3] Test environment of git-remote-mw Guillaume Sasdy
2012-06-01 11:49     ` Matthieu Moy
2012-06-01 14:43       ` Simon.Cathebras
2012-06-02 10:47         ` Matthieu Moy
2012-06-04 14:13           ` Simon.Cathebras
2012-06-01 10:41   ` [PATCH 3/3] Tests file for git-remote-mediawiki Guillaume Sasdy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338487992-305-1-git-send-email-guillaume.sasdy@ensimag.imag.fr \
    --to=guillaume.sasdy@ensimag.imag.fr \
    --cc=Julien.Khayat@ensimag.imag.fr \
    --cc=Matthieu.Moy@imag.fr \
    --cc=Simon.Perrat@ensimag.imag.fr \
    --cc=charles.roussel@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=simon.cathebras@ensimag.imag.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).