sapling/eden/integration/debug_test.py
Chad Austin e1e4bdee40 add a (failing) test of binary blob contents over thrift
Summary:
Add a disabled test that illustrates that binary data fails to
serialize between edenfs and the CLI with the current Thrift
implementation.

Reviewed By: fanzeyi

Differential Revision: D21890379

fbshipit-source-id: 725e99751e1d62c39f4059ec0f1197857c47e3b4
2020-06-10 19:29:42 -07:00

34 lines
1.1 KiB
Python

#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
import binascii
import os
from .lib import testcase
@testcase.eden_repo_test
class DebugBlobTest(testcase.EdenRepoTest):
def populate_repo(self) -> None:
self.repo.write_file("binary", b"\xff\xfe\xfd\xfc")
self.repo.commit("Initial commit.")
# TODO: enable when using the modern Python 3 Thrift API
def xtest_debug_blob_prints_binary_data(self) -> None:
with self.eden.get_thrift_client() as client:
debugInfo = client.debugInodeStatus(os.fsencode(self.mount), b".")
[root] = [entry for entry in debugInfo if entry.path == b""]
self.assertEqual(1, root.inodeNumber)
[file] = [entry for entry in root.entries if entry.name == b"binary"]
self.assertEqual(False, file.materialized)
blob_id = binascii.hexlify(file.hash).decode()
print(blob_id)
output = self.eden.run_cmd("debug", "blob", ".", blob_id, cwd=self.mount)
self.assertEqual(b"\xff\xfe\xfd\xfc", output)