tests: add Mononoke integration test target

Summary:
This adds a new test target that will use Mononoke as the server.
Initially we only support one test, but we can add to this list in the future.

Reviewed By: quark-zju

Differential Revision: D15382714

fbshipit-source-id: ad9b3bd35ffefc01239ff05f9f65829fb7a94555
This commit is contained in:
Durham Goode 2019-05-29 01:27:22 -07:00 committed by Facebook Github Bot
parent 2d477ee805
commit e2bfcbcca4
4 changed files with 40 additions and 9 deletions

View File

@ -3,6 +3,7 @@
$ setconfig commitcloud.hostname=testhost
$ setconfig remotefilelog.reponame=testrepo
$ setconfig mutation.record=true mutation.enabled=true
$ setconfig extensions.treemanifest=!
$ setconfig visibility.enabled=true
$ newrepo server

View File

@ -11,10 +11,10 @@
$ hg push -r tip --to master --create
pushing rev 79c51fb96423 to destination ssh://user@dummy/master bookmark master
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 2 changesets with 2 changes to 2 files
remote: adding changesets (?)
remote: adding manifests (?)
remote: adding file changes (?)
remote: added 2 changesets with 2 changes to 2 files (?)
exporting bookmark master
$ cd ..

View File

@ -3,6 +3,10 @@
_repocount=0
if [ -n "$USE_MONONOKE" ] ; then
. "$TESTDIR/../../mononoke/tests/integration/library.sh"
fi
# Create a new repo
newrepo() {
reponame="$1"
@ -16,7 +20,13 @@ newrepo() {
}
newserver() {
reponame="$1"
local reponame="$1"
if [ -n "$USE_MONONOKE" ] ; then
setup_mononoke_config
setup_mononoke_repo_config "$reponame"
mononoke
wait_for_mononoke "$TESTTMP/$reponame"
else
mkdir "$TESTTMP/$reponame"
cd "$TESTTMP/$reponame"
hg init --config extensions.lz4revlog=
@ -37,6 +47,7 @@ flatcompat=False
server=True
treeonly=True
EOF
fi
}
clone() {
@ -45,6 +56,9 @@ clone() {
shift 2
cd "$TESTTMP"
remotecmd="hg"
if [ -n "$USE_MONONOKE" ] ; then
remotecmd="$MONONOKE_HGCLI"
fi
hg clone -q --shallow "ssh://user@dummy/$servername" "$clientname" "$@" \
--config "extensions.lz4revlog=" \
--config "extensions.remotefilelog=" \
@ -78,6 +92,12 @@ treeonly=True
ssh=$TESTDIR/dummyssh
EOF
if [ -n "$USE_MONONOKE" ] ; then
cat >> $clientname/.hg/hgrc <<EOF
[ui]
remotecmd=$MONONOKE_HGCLI
EOF
fi
}
switchrepo() {

View File

@ -23,10 +23,14 @@ try:
hgpath = pathutils.get_build_rule_output_path("//scm/hg:hg")
pythonbinpath = pathutils.get_build_rule_output_path("//scm/hg:hgpython")
watchman = pathutils.get_build_rule_output_path("//watchman:watchman")
mononoke_server = pathutils.get_build_rule_output_path("//scm/mononoke:mononoke")
mononoke_hgcli = pathutils.get_build_rule_output_path("//scm/mononoke/hgcli:hgcli")
except ImportError:
hgpath = os.environ.get("HGTEST_HG")
pythonbinpath = os.environ.get("HGTEST_PYTHON", "python2")
watchman = os.environ.get("HGTEST_WATCHMAN")
mononoke_server = os.environ.get("HGTEST_MONONOKE_SERVER")
mononoke_hgcli = os.environ.get("HGTEST_MONONOKE_HGCLI")
try:
@ -66,6 +70,12 @@ def prepareargsenv(runtestsdir, port=None):
env["HGPYTHONPATH"] = pythonpath
# set other environments useful for buck testing
env["HGTEST_NORMAL_LAYOUT"] = "0"
# Variables needed for mononoke integration
if os.environ.get("USE_MONONOKE"):
env["MONONOKE_SERVER"] = mononoke_server
env["MONONOKE_HGCLI"] = mononoke_hgcli
return args, env