Skip to content

Commit

Permalink
[yugabyte#7014]: Fix backup unit tests.
Browse files Browse the repository at this point in the history
Summary: Commit yugabyte@335b3d9 and https://github.com/yugabyte/yugabyte-db/issues/3579c17b017f39f59f56a9c099baf16a4bf2326b broke the unit tests for backup. This diff addresses those issues.

Test Plan:
ybd --cxx-test tools_yb-backup-test_ent
ybd --java-test org.yb.cql.TestYbBackup
ybd --java-test org.yb.pgsql.TestYbBackup
Jenkins

Reviewers: sanketh, oleg

Reviewed By: oleg

Subscribers: jenkins-bot, ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D10478
  • Loading branch information
Arnav15 committed Jan 28, 2021
1 parent cb7d598 commit 7387548
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ent/src/yb/tools/yb-backup-test_ent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class YBBackupTest : public pgwrapper::PgCommandTestBase {
tmp_dir_ = JoinPathSegments(
tmp_dir_, string(CURRENT_TEST_CASE_NAME()) + '_' + RandomHumanReadableString(8));
}
// Create the directory if it doesn't exist.
if (!Env::Default()->DirExists(tmp_dir_)) {
EXPECT_OK(Env::Default()->CreateDir(tmp_dir_));
}

return JoinPathSegments(tmp_dir_, subdir);
}
Expand All @@ -69,6 +73,7 @@ class YBBackupTest : public pgwrapper::PgCommandTestBase {
<< " --ysql_host=" << pg_hp.host()
<< " --ysql_port=" << pg_hp.port()
<< " --storage_type nfs"
<< " --nfs_storage_path " << tmp_dir_
<< " --no_ssh"
<< " --no_auto_name";
#if defined(__APPLE__)
Expand Down
1 change: 1 addition & 0 deletions java/yb-client/src/test/java/org/yb/util/YBBackupUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static String runYbBackup(List<String> args) throws Exception {
"--remote_ysql_dump_binary=" + ysqlDumpPath,
"--remote_ysql_shell_binary=" + ysqlShellPath,
"--storage_type", "nfs",
"--nfs_storage_path", TestUtils.getBaseTmpDir(),
"--no_ssh",
"--no_auto_name"));

Expand Down
6 changes: 3 additions & 3 deletions managed/devops/bin/yb_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ def run_ssh_cmd(self, cmd, server_ip, upload_cloud_cfg=True, num_ssh_retry=3, en
'cd / && %s bash -c ' % (change_user_cmd) + pipes.quote(cmd)],
num_retry=num_retries)
else:
return self.run_program(['bash', '-c', pipes.quote(cmd)])
return self.run_program(['bash', '-c', cmd])

def find_data_dirs(self, tserver_ip):
"""
Expand Down Expand Up @@ -1653,11 +1653,11 @@ def find_nfs_storage(self, tserver_ip):
:param tserver_ip: tablet server ip
"""
try:
self.run_ssh_cmd(['find', self.args.nfs_storage_path], tserver_ip)
self.run_ssh_cmd(['ls', self.args.nfs_storage_path], tserver_ip)
except Exception as ex:
raise BackupException(
('Did not find nfs backup storage path: %s mounted on tablet server %s'
% (self.args.nfs_storage_path, tserver_ip)))
% (self.args.nfs_storage_path, tserver_ip)))

def upload_metadata_and_checksum(self, src_path, dest_path):
"""
Expand Down

0 comments on commit 7387548

Please sign in to comment.