sapling/eden/integration/rage_test.py
Adam Simpkins a26b8e9930 update edenfsctl to report the compile-time version
Summary:
Update most locations in edenfsctl to report the version number that was built
into the edenfsctl binary at build time, rather than querying the RPM database
for the installed RPM version.  The RPM behavior only works on to RedHat-based
Linux systems, and the currently running process doesn't necessarily have to
have come from the RPM.

The one place where we do still attempt to print the RPM version is in the
`edenfsctl rage` report, when running on Linux.

Reviewed By: wez

Differential Revision: D21000168

fbshipit-source-id: 0fb747e71b6950d74f22c458efa0dfcbd45270bd
2020-04-22 12:48:48 -07:00

52 lines
2.2 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 logging
from .lib import repobase, testcase
class RageTest(testcase.EdenRepoTest):
def populate_repo(self) -> None:
self.repo.write_file("README.md", "docs\n")
self.repo.commit("Initial commit.")
def create_repo(self, name: str) -> repobase.Repository:
return self.create_hg_repo(name)
def test_rage_output(self) -> None:
output = self.eden.run_cmd("rage", "--stdout")
logging.info(f"Rage output:\n{output}")
self.assert_output_includes_unconditional_checks(output)
self.assertRegex(output, r"\nbuild_package_release\s*:")
self.assertRegex(output, r"\nbuild_package_version\s*:")
self.assertRegex(output, r"\nuptime\s*:")
self.assertIn(f"\nChecking {self.mount}\n", output)
self.assertIn("edenfs memory usage", output)
def test_rage_output_with_stopped_daemon(self) -> None:
self.eden.shutdown()
output = self.eden.run_cmd("rage", "--stdout")
logging.info(f"Rage output:\n{output}")
self.assert_output_includes_unconditional_checks(output)
def assert_output_includes_unconditional_checks(self, output: str) -> None:
# Check to make sure that various important sections of information
# are present in the rage output.
#
# We may need to update this in the future if we modify the rage output; the
# main purpose it simply to make sure that the rage command did not exit early
# or crash partway through the output.
self.assertRegex(output, r"^User\s*:")
self.assertRegex(output, r"\nHostname\s*:")
self.assertRegex(output, r"\nVersion\s*:")
self.assertIn("\neden doctor --dry-run", output)
self.assertIn("\nMost recent Eden logs:\n", output)
self.assertIn("\nList of running Eden processes:\n", output)
self.assertIn("\nList of mount points:\n", output)
self.assertIn(f"\nMount point info for path {self.mount}:\n", output)
self.assertIn(f"{self.mount}\n", output)