Skip to contentSkip to conversation

http-push: update tests

PATCH In review Ray Chuan 4 participants 10 messages Jun 15, 2016

lore
Share & tools
lore

Ray Chuan

author
#0 lore raw

PATCH 3/3 http-push: update tests

note: the test needs to chmod the test_repo.git folder so that apache/mod_dav can create .DAV folders in it for locking.

---
 src/git-1.6.1/t/t5540-http-push.sh |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/src/git-1.6.1/t/t5540-http-push.sh
index da95886..730b9cb 100755

src/git-1.6.1/t/t5540-http-push.sh +3 -4
@@ -51,17 +51,16 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
-	git push &&
-	[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
+	git push origin master
 '
 
-test_expect_failure 'create and delete remote branch' '
+test_expect_success 'create and delete remote branch' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	git checkout -b dev &&
 	: >path3 &&
Signature · 1 line
1.6.0.4
#1 lore raw

Hi,

Quoted 2 lines · Ray Chuan

note: the test needs to chmod the test_repo.git folder so that apache/mod_dav can create .DAV folders in it for locking.

Is this supposed to explain ...

Quoted 5 lines
src/git-1.6.1/t/t5540-http-push.sh +0 -1
@@ -51,17 +51,16 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
-test_expect_failure 'push to remote repository' '

src/git-1.6.1/t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 61

Quoted 10 lines
src/git-1.6.1/t/t5540-http-push.sh +2 -2
+test_expect_success 'push to remote repository' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
-	git push &&
-	[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
+	git push origin master
 '

... this removal? I do not think this is a good change, as it removes a test that is actually pretty important.

BTW I do not understand at all what you mean by "we need to chmod". Does the Apache instance not run with the current user's permissions?

Ciao,
Dscho

author
#2 lore raw

Hi,

Quoted 13 lines · Johannes Schindelin

Hi,

Quoted 2 lines · Ray Chuan

note: the test needs to chmod the test_repo.git folder so that apache/mod_dav can create .DAV folders in it for locking.

Is this supposed to explain ...

Quoted 4 lines
src/git-1.6.1/t/t5540-http-push.sh +0 -0
@@ -51,17 +51,16 @@ test_expect_success 'clone remote repository' '
      git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
Quoted 14 lines

src/git-1.6.1/t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 61

Quoted 11 lines
src/git-1.6.1/t/t5540-http-push.sh +2 -3
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
      cd "$ROOT_PATH"/test_repo_clone &&
      : >path2 &&
      git add path2 &&
      test_tick &&
      git commit -m path2 &&
-     git push &&
-     [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
+     git push origin master
 '

... this removal? I do not think this is a good change, as it removes a test that is actually pretty important.

i'm sorry for the poor commit message, what i wanted to do was to change the tests to expect success rather than failure. no tests were removed; only their expected outcomes were modified. currently, the pushes fail, so the test 'fails as expected'; now the pushes succeed, so they shouldn't be expecting failed pushes (or anything else).

Quoted 2 lines

BTW I do not understand at all what you mean by "we need to chmod". Does the Apache instance not run with the current user's permissions?

i wrote 'we need to chmod', cos i'm not sure what the permissions are required. sorry, i didn't notice that apache was running with the current user's permissions. but i added the note just in case, for users who don't run apache with the current user, so they modify the test appropriately (ie adding a chmod).

Quoted 3 lines

Ciao,
Dscho

Signature · 2 lines
Cheers,
Ray Chuan
#3 lore raw
Quoted 15 lines · Ray Chuan
Quoted 6 lines
Quoted 6 lines
src/git-1.6.1/t/t5540-http-push.sh +1 -1
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
      cd "$ROOT_PATH"/test_repo_clone &&
      : >path2 &&
      git add path2 &&
      test_tick &&
Quoted 8 lines

src/git-1.6.1/t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 61

Quoted 5 lines
      git commit -m path2 &&
src/git-1.6.1/t/t5540-http-push.sh +1 -2
-     git push &&
-     [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
+     git push origin master
 '

... this removal? I do not think this is a good change, as it removes a test that is actually pretty important.

Quoted 5 lines

i'm sorry for the poor commit message, what i wanted to do was to change the tests to expect success rather than failure. no tests were removed; only their expected outcomes were modified. currently, the pushes fail, so the test 'fails as expected'; now the pushes succeed, so they shouldn't be expecting failed pushes (or anything else).

The original seems to want the push to succeed, and also it wants the file refs/heads/master to be present after the push (presumably because there should be that ref when the push succeeds). If you fixed "push" that used to fail to succeed, that is great, and s/failure/success/ is a good thing.

But you are removing something else without explanation. Why do you need to remove the part of the test that checks if refs/heads/master is present? Is it looking for a file in a wrong place?

#4 lore raw

Hi,

Quoted 9 lines · Junio C Hamano

The original seems to want the push to succeed, and also it wants the file refs/heads/master to be present after the push (presumably because there should be that ref when the push succeeds). If you fixed "push" that used to fail to succeed, that is great, and s/failure/success/ is a good thing.

But you are removing something else without explanation. Why do you need to remove the part of the test that checks if refs/heads/master is present? Is it looking for a file in a wrong place?

As I mentioned with two other patches, the push does not succeed, and that is the reason for the "failure" in test_expect_failure.

It does not succeed for two reasons:

- due to an off-by-path_len bug, xmalloc() tries to allocate ~4GB of memory, which is a bit much, so http-push die()s with an OOM.

- even with that fix, the push fails because it cannot find any common refs. It cannot find them because it does not download info/refs as it is supposed to do, but it looks through refs/, missing the fact that the refs are packed (which it cannot handle).

Ciao,
Dscho

author
#5 lore raw
In reply to Junio C Hamano

Hi,

Quoted 11 lines · Junio C Hamano
Quoted 9 lines · Ray Chuan
Quoted 9 lines

src/git-1.6.1/t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 61

Quoted 9 lines
src/git-1.6.1/t/t5540-http-push.sh +1 -3
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
      cd "$ROOT_PATH"/test_repo_clone &&
      : >path2 &&
      git add path2 &&
      test_tick &&
      git commit -m path2 &&
-     git push &&
-     [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]

i modified the push arguments as there was no remote ref/branch specified. With a fixed "git push", that line says:

No refs in common and none specified; doing nothing.

i'd like to take this chance to inquire, what does the -f, plus square brackets, really mean? i assumed it was to force push to go ahead even if "a remote ref that is not an ancestor of the local ref used to overwrite it" check fails.

Signature · 2 lines
Cheers,
Ray Chuan
#6 lore raw
Quoted 6 lines · Ray Chuan
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

src/git-1.6.1/t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 61

Quoted 2 lines
src/git-1.6.1/t/t5540-http-push.sh +0 -2
-     git push &&
-     [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]

i modified the push arguments as there was no remote ref/branch specified. With a fixed "git push", that line says:

Quoted 6 lines

No refs in common and none specified; doing nothing.

i'd like to take this chance to inquire, what does the -f, plus square brackets, really mean? i assumed it was to force push to go ahead even if "a remote ref that is not an ancestor of the local ref used to overwrite it" check fails.

Errr...

git push &&
[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]

means, do "git push", and if it succeeds test (which should really be written as 'test <cond>' and not '[ <cond> ]' I think) if the file does exists and is regular file ('help test' or 'man test').

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git
author
#7 lore raw

change tests to expect success.

---
 t/t5540-http-push.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
t/t5540-http-push.sh +3 -3
index da95886..4acc087 100755
@@ -51,17 +51,17 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
-	git push &&
+	git push origin master &&
 	[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
 '
 
-test_expect_failure 'create and delete remote branch' '
+test_expect_success 'create and delete remote branch' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	git checkout -b dev &&
 	: >path3 &&
Signature · 1 line
1.5.6.3
#8 lore raw
Quoted 3 lines · Ray Chuan

Subject: [PATCH 3/3] http-push: update tests

change tests to expect success.

Minor nit: I would use here

Subject: [PATCH 3/3] http-push: change tests to expect success

Signature · 2 lines
Jakub Narebski
Poland
#9 lore raw
In reply to Ray Chuan

Hi,

t/t5540-http-push.sh test_expect_success 'clone remote repository' ' · line 62

Quoted 11 lines · Ray Chuan
t/t5540-http-push.sh +2 -2
-test_expect_failure 'push to remote repository' '
+test_expect_success 'push to remote repository' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
-	git push &&
+	git push origin master &&
 	[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
 '

But it _should_ succeed without <remote> <branch>. It should find that there is a master locally and one remotely, and push that.

Ciao,
Dscho