forked from facebook/sapling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mononoke/integration tests: publicize hook and megarepo tests (facebo…
…ok#61) Summary: Pull Request resolved: facebook#61 Differential Revision: D23818467 fbshipit-source-id: c5e788ca002cdfbcbd0311e98ed5db16965afe14
- Loading branch information
1 parent
268a991
commit 1bd0ade
Showing
14 changed files
with
1,914 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
eden/mononoke/tests/integration/test-hook-block-empty-commit.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This software may be used and distributed according to the terms of the | ||
# GNU General Public License found in the LICENSE file in the root | ||
# directory of this source tree. | ||
|
||
$ . "${TEST_FIXTURES}/library.sh" | ||
$ hook_test_setup \ | ||
> block_empty_commit | ||
|
||
$ hg up -q tip | ||
|
||
$ echo 1 > 1 && hg -q addremove && hg ci -m empty | ||
$ hg revert -r ".^" 1 && hg commit --amend | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev afd5c05eb235 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: block_empty_commit for afd5c05eb235daf088b93d9cbc0dfecbb267a01a: You must include file changes in your commit for it to land | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: block_empty_commit for afd5c05eb235daf088b93d9cbc0dfecbb267a01a: You must include file changes in your commit for it to land | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nblock_empty_commit for afd5c05eb235daf088b93d9cbc0dfecbb267a01a: You must include file changes in your commit for it to land" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] | ||
|
||
$ echo 1 > 1 && hg addremove && hg ci --amend -m nonempty | ||
adding 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev d2f8add702e6 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 0 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark |
50 changes: 50 additions & 0 deletions
50
eden/mononoke/tests/integration/test-hook-check-nocommit.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This software may be used and distributed according to the terms of the | ||
# GNU General Public License found in the LICENSE file in the root | ||
# directory of this source tree. | ||
|
||
# This tests @nocommit, so we need to suppress the lint | ||
# @lint-ignore-every NOCOMMIT | ||
|
||
$ . "${TEST_FIXTURES}/library.sh" | ||
|
||
$ hook_test_setup check_nocommit <() | ||
|
||
$ hg up tip | ||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
|
||
No @nocommit, should work | ||
|
||
$ echo "foo" > foo | ||
$ hg ci -Aqm 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 8b8214d70c17 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 0 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Has @nocommit, should fail | ||
|
||
$ hg up -q 0 | ||
$ echo "bar @nocommit" > foo | ||
$ hg ci -Aqm 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 2a4a4062249a to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: check_nocommit for 2a4a4062249a2c8175ec17dc89a27ed30580ace2: File contains a @nocommit marker: foo | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: check_nocommit for 2a4a4062249a2c8175ec17dc89a27ed30580ace2: File contains a @nocommit marker: foo | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\ncheck_nocommit for 2a4a4062249a2c8175ec17dc89a27ed30580ace2: File contains a @nocommit marker: foo" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] |
142 changes: 142 additions & 0 deletions
142
eden/mononoke/tests/integration/test-hook-conflict-markers.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This software may be used and distributed according to the terms of the | ||
# GNU General Public License found in the LICENSE file in the root | ||
# directory of this source tree. | ||
|
||
$ . "${TEST_FIXTURES}/library.sh" | ||
|
||
$ hook_test_setup \ | ||
> conflict_markers <( | ||
> echo 'bypass_commit_string="@ignore-conflict-markers"' | ||
> ) | ||
|
||
Negative testing | ||
$ markers_good=('<<<<<<<' | ||
> '<<<<<<<<<<' | ||
> '>>>>>>>' | ||
> '<<<<<<<' | ||
> '>>>>>>>>>>' | ||
> '=====' | ||
> '===============') | ||
$ hg up -q 0 | ||
|
||
$ i=0 | ||
$ for input in "${markers_good[@]}"; do | ||
> i=$((i+1)) | ||
> printf "$input" > "file$i" | ||
> done | ||
$ hg ci -Aqm 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 069fca863ff8 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 1 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Positive testing | ||
$ hg up -q 0 | ||
$ echo '>>>>>>> 123' > 1 && hg add 1 && hg ci -m 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 17a746afd78e to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: conflict_markers for 17a746afd78ed3f7f06d1d5396fa89adf656ae51: Conflict markers were found in file '1' | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: conflict_markers for 17a746afd78ed3f7f06d1d5396fa89adf656ae51: Conflict markers were found in file '1' | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nconflict_markers for 17a746afd78ed3f7f06d1d5396fa89adf656ae51: Conflict markers were found in file \'1\'" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] | ||
|
||
$ hg up -q 0 | ||
$ echo '<<<<<<< 123' > 1 && hg add 1 && hg ci -m 1 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 948f2ceaf570 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: conflict_markers for 948f2ceaf570f89539966000cf65d4a56dc4ec37: Conflict markers were found in file '1' | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: conflict_markers for 948f2ceaf570f89539966000cf65d4a56dc4ec37: Conflict markers were found in file '1' | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nconflict_markers for 948f2ceaf570f89539966000cf65d4a56dc4ec37: Conflict markers were found in file \'1\'" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] | ||
|
||
Negative testing | ||
Files with bad markers should be accepted with these suffixes | ||
$ hg up -q 0 | ||
$ suffixes=('.md' '.markdown' '.rdoc' '.rst') | ||
$ for suffix in "${suffixes[@]}"; do | ||
$ echo ">>>>>>> " > "file$suffix" | ||
$ done | ||
$ hg ci -Aqm 'markdowns' | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev ced9269b0dde to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 1 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Negative Testing | ||
Files with bad markers should be accepted if they are binary. | ||
File is considered binary if it contains \0 | ||
$ hg up -q 0 | ||
$ echo -e ">>>>>>> \0" > file | ||
$ hg ci -Aqm binary | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev e913daf3ef9f to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 1 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Test bypass | ||
$ hg up -q 0 | ||
$ echo -e ">>>>>>> " > largefile | ||
$ hg ci -Aqm '@ignore-conflict-markers' | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev a45fdf76c250 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 1 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Test markers not on the first line | ||
$ hg up -q 0 | ||
$ echo -e "ololo\nonemore\n\n>>>>>>> " > notfirstline | ||
$ hg ci -Aqm notfirstline | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev * to destination ssh://user@dummy/repo bookmark master_bookmark (glob) | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: conflict_markers for be491e50f4868f90970fb2267d7724d8580780af: Conflict markers were found in file 'notfirstline' | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: conflict_markers for be491e50f4868f90970fb2267d7724d8580780af: Conflict markers were found in file 'notfirstline' | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nconflict_markers for be491e50f4868f90970fb2267d7724d8580780af: Conflict markers were found in file \'notfirstline\'" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] |
75 changes: 75 additions & 0 deletions
75
eden/mononoke/tests/integration/test-hook-limit-commit-message-length.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This software may be used and distributed according to the terms of the | ||
# GNU General Public License found in the LICENSE file in the root | ||
# directory of this source tree. | ||
|
||
$ . "${TEST_FIXTURES}/library.sh" | ||
|
||
|
||
$ hook_test_setup \ | ||
> limit_commit_message_length <( | ||
> cat <<CONF | ||
> config_strings={length_limit="10"} | ||
> CONF | ||
> ) | ||
|
||
$ hg up tip | ||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||
|
||
Ok commit message - should pass | ||
|
||
$ touch file1 | ||
$ hg ci -Aqm 123456789 | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev f95217ebe3a8 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
adding changesets | ||
adding manifests | ||
adding file changes | ||
added 0 changesets with 0 changes to 0 files | ||
updating bookmark master_bookmark | ||
|
||
Commit message too long - should fail | ||
|
||
$ hg up -q 0 | ||
$ touch file2 | ||
$ hg ci -Aqm "$(printf "%s\n%s" "foo" "123456")" | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 6ef9fe6a13fa to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: limit_commit_message_length for 6ef9fe6a13fa92ed3a2fdc0843441c0511cd47f6: Commit message length for 'foo' (10) exceeds length limit (>= 10) | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: limit_commit_message_length for 6ef9fe6a13fa92ed3a2fdc0843441c0511cd47f6: Commit message length for 'foo' (10) exceeds length limit (>= 10) | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nlimit_commit_message_length for 6ef9fe6a13fa92ed3a2fdc0843441c0511cd47f6: Commit message length for \'foo\' (10) exceeds length limit (>= 10)" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] | ||
|
||
Commit message too long (UTF-8 multibyte characters) - should fail | ||
|
||
$ hg up -q 0 | ||
$ touch file3 | ||
$ hg ci -Aqm "$(printf "%s\n%s" "foo" "1234€")" | ||
$ hgmn push -r . --to master_bookmark | ||
pushing rev 0531ec587487 to destination ssh://user@dummy/repo bookmark master_bookmark | ||
searching for changes | ||
remote: Command failed | ||
remote: Error: | ||
remote: hooks failed: | ||
remote: limit_commit_message_length for 0531ec5874870ef2b56c302d7844038e71efce54: Commit message length for 'foo' (11) exceeds length limit (>= 10) | ||
remote: | ||
remote: Root cause: | ||
remote: hooks failed: | ||
remote: limit_commit_message_length for 0531ec5874870ef2b56c302d7844038e71efce54: Commit message length for 'foo' (11) exceeds length limit (>= 10) | ||
remote: | ||
remote: Debug context: | ||
remote: "hooks failed:\nlimit_commit_message_length for 0531ec5874870ef2b56c302d7844038e71efce54: Commit message length for \'foo\' (11) exceeds length limit (>= 10)" | ||
abort: stream ended unexpectedly (got 0 bytes, expected 4) | ||
[255] |
Oops, something went wrong.