sapling/eden/mononoke/tests/integration/test-edenapi-server-trees.t
Arun Kulshreshtha 3223d12f99 edenapi: add data subcommand to read_res
Summary: Previously, `read_res` was called `data_util` and only dealt with EdenAPI data responses. Support for history responses was added later as a `history` subcommand. For consistency, let's move the top-level commands for data responses underneath a new `data` subcommand. When support for addition response types is added in the future, those can also go under their own subcommands.

Reviewed By: quark-zju

Differential Revision: D21825197

fbshipit-source-id: f5cb759a68324e7d0f98e3448bd5d1cba6417bad
2020-06-02 12:49:18 -07:00

74 lines
2.0 KiB
Perl

# 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"
Set up local hgrc and Mononoke config.
$ setup_common_config
$ cd $TESTTMP
Initialize test repo.
$ hginit_treemanifest repo-hg
$ cd repo-hg
$ setup_hg_server
Populate test repo
$ echo "test content" > test.txt
$ hg commit -Aqm "add test.txt"
$ ROOT_MFID_1=$(hg log -r . -T '{manifest}')
$ hg cp test.txt copy.txt
$ hg commit -Aqm "copy test.txt to test2.txt"
$ ROOT_MFID_2=$(hg log -r . -T '{manifest}')
Blobimport test repo.
$ cd ..
$ blobimport repo-hg/.hg repo
Start up EdenAPI server.
$ setup_mononoke_config
$ start_edenapi_server
Create and send tree request.
$ edenapi_make_req data > req.cbor <<EOF
> [
> ["", "$ROOT_MFID_1"],
> ["", "$ROOT_MFID_2"]
> ]
> EOF
Reading from stdin
Generated request: DataRequest {
keys: [
Key {
path: RepoPathBuf(
"",
),
hgid: HgId("15024c4dc4a27b572d623db342ae6a08d7f7adec"),
},
Key {
path: RepoPathBuf(
"",
),
hgid: HgId("c8743b14e0789cc546125213c18a18d813862db5"),
},
],
}
$ sslcurl -s "$EDENAPI_URI/repo/trees" -d@req.cbor > res.cbor
Check trees in response.
$ edenapi_read_res data ls res.cbor
Reading from file: "res.cbor"
15024c4dc4a27b572d623db342ae6a08d7f7adec
c8743b14e0789cc546125213c18a18d813862db5
$ edenapi_read_res data cat res.cbor -p '' -h $ROOT_MFID_1
Reading from file: "res.cbor"
test.txt\x00186cafa3319c24956783383dc44c5cbc68c5a0ca (esc)
$ edenapi_read_res data cat res.cbor -p '' -h $ROOT_MFID_2
Reading from file: "res.cbor"
copy.txt\x0017b8d4e3bafd4ec4812ad7c930aace9bf07ab033 (esc)
test.txt\x00186cafa3319c24956783383dc44c5cbc68c5a0ca (esc)