def test_extract_gpdb_version(self): temp_dir = tempfile.mkdtemp() os.chdir(temp_dir) bin_gpdb_path = 'bin_gpdb.tar.gz' git_info_path = 'git-info.json' with open(git_info_path, "w") as git_info: git_info.write('{"root":{"version":"a-real-sha"}}') with tarfile.open(bin_gpdb_path, "w:gz") as tar: tar.add(git_info_path, arcname="./etc/git-info.json") self.assertEqual(Util.extract_gpdb_version(bin_gpdb_path), "a-real-sha") shutil.rmtree(temp_dir)
def gpdb_version_short(self): if self._gpdb_version_short is None: self._gpdb_version_short = Util.extract_gpdb_version( self.bin_gpdb_path) return self._gpdb_version_short