Skip to content

Commit ac644f1

Browse files
committed
[smb_mount] fix smb mount tests
1 parent 66891be commit ac644f1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/windows/test_smb_mount_handler.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ struct SmbMountHandlerTest : public ::Test
8181
EXPECT_CALL(platform, get_username).WillOnce(Return(username));
8282
ON_CALL(utils, contents_of).WillByDefault(Return("irrelevant"));
8383
ON_CALL(utils, make_file_with_content(_, _)).WillByDefault(Return());
84+
EXPECT_CALL(utils, make_uuid(std::make_optional(vm.vm_name)))
85+
.WillOnce(Return(vm_name_uuid));
8486
EXPECT_CALL(utils, make_uuid(std::make_optional(target))).WillOnce(Return(target_uuid));
8587
EXPECT_CALL(utils, make_uuid(std::make_optional(username.toStdString())))
8688
.WillOnce(Return(username_uuid));
@@ -134,6 +136,7 @@ struct SmbMountHandlerTest : public ::Test
134136
NiceMock<mpt::MockVirtualMachine> vm{"my_instance"};
135137
std::string source{"source"}, target{"target"};
136138
QString target_uuid{"d02a0ba3-2170-46ac-9445-1943a0fe82e6"};
139+
QString vm_name_uuid{"d02a0ba3-2170-46ac-9445-1943a0fe82e6"};
137140
mp::id_mappings gid_mappings{{1, 2}}, uid_mappings{{5, 6}};
138141
mp::VMMount mount{source, gid_mappings, uid_mappings, mp::VMMount::MountType::Native};
139142

@@ -159,11 +162,7 @@ struct SmbMountHandlerTest : public ::Test
159162
std::string remote_cred_file{"/tmp/.smb_credentials"};
160163
std::string enc_key{"key"};
161164
std::string smb_share_name =
162-
QString("%1_%2:%3")
163-
.arg(target_uuid, QString::fromStdString(vm.vm_name), QString::fromStdString(target))
164-
.left(80)
165-
.toStdString();
166-
165+
fmt::format("{}-{}", vm_name_uuid.toStdString(), target_uuid.toStdString());
167166
std::string dpkg_command{"dpkg-query --show --showformat='${db:Status-Status}' cifs-utils"};
168167
std::string install_cifs_command{"sudo apt-get update && sudo apt-get install -y cifs-utils"};
169168
std::string mkdir_command{"mkdir -p " + target};

0 commit comments

Comments
 (0)