-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration test for pull with multiple branches
Summary: Similar to the last test but this time supporting pull instead of clone Differential Revision: D55066185 fbshipit-source-id: 88dd045be4d245d5e6a6e259b21efd1eaaaf77f4
- Loading branch information
1 parent
02c01f8
commit bc8fc2d
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
eden/mononoke/tests/integration/test-mononoke-git-server-multibranch-pull.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,93 @@ | ||
# Copyright (c) Meta Platforms, Inc. and 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. | ||
|
||
# Integration test based on scenario: https://internalfb.com/excalidraw/EX180257 | ||
$ . "${TEST_FIXTURES}/library.sh" | ||
$ REPOTYPE="blob_files" | ||
$ ENABLED_DERIVED_DATA='["git_commits", "git_trees", "git_delta_manifests", "unodes", "filenodes", "hgchangesets"]' setup_common_config $REPOTYPE | ||
$ GIT_REPO_ORIGIN="${TESTTMP}/origin/repo-git" | ||
$ GIT_REPO="${TESTTMP}/repo-git" | ||
$ HG_REPO="${TESTTMP}/repo-hg" | ||
$ BUNDLE_PATH="${TESTTMP}/repo_bundle.bundle" | ||
$ cat >> repos/repo/server.toml <<EOF | ||
> [source_control_service] | ||
> permit_writes = true | ||
> EOF | ||
|
||
# Setup git repository | ||
$ mkdir -p "$GIT_REPO_ORIGIN" | ||
$ cd "$GIT_REPO_ORIGIN" | ||
$ git init -q | ||
# Add a base commit on master | ||
$ echo "this is origin" > origin | ||
$ git add origin | ||
$ git commit -qam "Add origin" | ||
# Create branch R1 from master and add two commits on it | ||
$ git checkout -qb R1 | ||
$ echo "this is file1" > file1 | ||
$ git add file1 | ||
$ git commit -qam "Add file1 in branch R1" | ||
$ echo "this is file1.1" > file1 | ||
$ git add file1 | ||
$ git commit -qam "Modified file1 -> file1.1 in branch R1" | ||
# Create branch R2 from master and add one commit on it | ||
$ git checkout -qb R2 master | ||
$ echo "this is file1.2" > file1 | ||
$ git add file1 | ||
$ git commit -qam "Add file1.2 in branch R2" | ||
|
||
$ cd "$TESTTMP" | ||
$ git clone "$GIT_REPO_ORIGIN" | ||
Cloning into 'repo-git'... | ||
done. | ||
|
||
# Capture all the known Git objects from the repo | ||
$ cd $GIT_REPO | ||
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list | ||
|
||
# Import it into Mononoke | ||
$ cd "$TESTTMP" | ||
$ quiet gitimport "$GIT_REPO" --derive-hg --generate-bookmarks full-repo | ||
|
||
# Start up the Mononoke Git Service | ||
$ mononoke_git_service | ||
# Clone the Git repo from Mononoke | ||
$ git_client clone $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git | ||
Cloning into 'repo'... | ||
# Verify that we get the same Git repo back that we started with | ||
$ cd $REPONAME | ||
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list | ||
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list | ||
|
||
# Add more commits to the original git repo | ||
$ cd $GIT_REPO_ORIGIN | ||
$ git checkout -q R1 | ||
$ echo "this is file1.2" > file1 | ||
$ git add file1 | ||
$ git commit -qam "Modified file1.1 -> file1.2 in branch R1" | ||
$ git checkout -q R2 | ||
$ echo "this is file1" > file1 | ||
$ git add file1 | ||
$ git commit -qam "Modified file1.2 -> file1 in branch R2" | ||
|
||
$ cd "$GIT_REPO" | ||
$ git pull "$GIT_REPO_ORIGIN" &> /dev/null | ||
# Capture all the known Git objects from the repo | ||
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/object_list_after_pull | ||
# Diff the list of objects before and after the pull to show that we got new objects | ||
$ diff -w -q $TESTTMP/object_list $TESTTMP/object_list_after_pull | ||
Files $TESTTMP/object_list and $TESTTMP/object_list_after_pull differ | ||
[1] | ||
|
||
# Import the newly added commits to Mononoke | ||
$ cd "$TESTTMP" | ||
$ quiet gitimport "$GIT_REPO_ORIGIN" --derive-hg --generate-bookmarks full-repo | ||
# Pull the Git repo from Mononoke | ||
$ cd $REPONAME | ||
$ git_client pull $MONONOKE_GIT_SERVICE_BASE_URL/$REPONAME.git &> /dev/null | ||
# Verify that we get the same Git repo back that we started with | ||
$ git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(rest)' | sort > $TESTTMP/new_object_list | ||
$ diff -w $TESTTMP/new_object_list $TESTTMP/object_list_after_pull |