Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #3566

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/multipass/async_periodic_download_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AsyncPeriodicDownloadTask
mpl::log(mpl::Level::debug, "async task", std::string(launch_msg));
future = QtConcurrent::run(std::forward<Callable>(func), std::forward<Args>(args)...);

auto event_handler_on_sucess_and_failure = [retry_start_delay_time, this]() -> void {
auto event_handler_on_success_and_failure = [retry_start_delay_time, this]() -> void {
try
{
// rethrow exception
Expand All @@ -88,7 +88,7 @@ class AsyncPeriodicDownloadTask
}
};

QObject::connect(&future_watcher, &QFutureWatcher<ReturnType>::finished, event_handler_on_sucess_and_failure);
QObject::connect(&future_watcher, &QFutureWatcher<ReturnType>::finished, event_handler_on_success_and_failure);
future_watcher.setFuture(future);

QObject::connect(&timer, &QTimer::timeout, [launch_msg, this, func, args...]() -> void {
Expand Down
2 changes: 1 addition & 1 deletion include/multipass/yaml_node_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ YAML::Node make_cloud_init_meta_config_with_id_tweak(const std::string& file_con
YAML::Node make_cloud_init_network_config(const std::string& default_mac_addr,
const std::vector<NetworkInterface>& extra_interfaces,
const std::string& file_content = std::string{});
// adds one extra interface to the network_config_file_content baseline, it creats the default address node
// adds one extra interface to the network_config_file_content baseline, it creates the default address node
// together with the extra interface node when it is empty,
YAML::Node add_extra_interface_to_network_config(const std::string& default_mac_addr,
const NetworkInterface& extra_interface,
Expand Down
2 changes: 1 addition & 1 deletion src/client/cli/cmd/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mp::ReturnCode cmd::Shell::run(mp::ArgParser* parser)
if (reply.ssh_info().empty())
return ReturnCode::Ok;

// TODO: this should setup a reader that continously prints out
// TODO: this should setup a reader that continuously prints out
// streaming replies from the server corresponding to stdout/stderr streams
const auto& ssh_info = reply.ssh_info().begin()->second;
const auto& host = ssh_info.host();
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/daemon_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ std::unique_ptr<QNetworkProxy> discover_http_proxy()
QString http_proxy{qgetenv("http_proxy")};
if (http_proxy.isEmpty())
{
// Some OS's are case senstive
// Some OS's are case sensitive
http_proxy = qgetenv("HTTP_PROXY");
}

Expand Down
4 changes: 2 additions & 2 deletions src/iso/cloud_init_iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,9 @@ void mp::CloudInitIso::read_from(const std::filesystem::path& fs_path)
const std::vector<uint8_t> encoded_file_name =
read_bytes_to_vec(iso_file, file_name_start_pos, to_u32(encoded_file_name_length));

const std::string orginal_file_name = convert_u16_name_back(
const std::string original_file_name = convert_u16_name_back(
std::string_view{reinterpret_cast<const char*>(encoded_file_name.data()), encoded_file_name.size()});
files.emplace_back(FileEntry{orginal_file_name, std::string{file_content.cbegin(), file_content.cend()}});
files.emplace_back(FileEntry{original_file_name, std::string{file_content.cbegin(), file_content.cend()}});

current_file_record_start_pos += to_u32(file_record_data_size);
}
Expand Down
6 changes: 3 additions & 3 deletions src/network/ip_address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace mp = multipass;

namespace
{
uint8_t as_octect(uint32_t value)
uint8_t as_octet(uint32_t value)
{
return static_cast<uint8_t>(value);
}
Expand All @@ -49,12 +49,12 @@ std::array<uint8_t, 4> parse(const std::string& ip)
check_range(c);
check_range(d);

return {{as_octect(a), as_octect(b), as_octect(c), as_octect(d)}};
return {{as_octet(a), as_octet(b), as_octet(c), as_octet(d)}};
}

std::array<uint8_t, 4> to_octets(uint32_t value)
{
return {{as_octect(value >> 24u), as_octect(value >> 16u), as_octect(value >> 8u), as_octect(value)}};
return {{as_octet(value >> 24u), as_octet(value >> 16u), as_octet(value >> 8u), as_octet(value)}};
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/backends/qemu/linux/dnsmasq_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void mp::DNSMasqServer::release_mac(const std::string& hw_addr)
auto ip = get_ip_for(hw_addr);
if (!ip)
{
mpl::log(mpl::Level::warning, "dnsmasq", fmt::format("attempting to release non-existant addr: {}", hw_addr));
mpl::log(mpl::Level::warning, "dnsmasq", fmt::format("attempting to release non-existent addr: {}", hw_addr));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/linux/mock_apparmor_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using namespace std;

int main(int argc, char* argv[])
{
// looks for version just to ensure existance
// looks for version just to ensure existence
if (argc == 2 && strcmp(argv[1], "-V") == 0)
{
cout << "AppArmor parser version 1.11" << endl;
Expand Down
2 changes: 1 addition & 1 deletion tests/linux/test_backend_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ struct CreateBridgeExceptionTest : public CreateBridgeTest, WithParamInterface<b
TEST_P(CreateBridgeExceptionTest, create_bridge_exception_info)
{
auto rollback = GetParam();
static constexpr auto specific_info = "spefic error details";
static constexpr auto specific_info = "specific error details";
auto generic_msg = fmt::format("Could not {} bridge", rollback ? "rollback" : "create");
EXPECT_THAT((mp::backend::CreateBridgeException{specific_info, QDBusError{}, rollback}),
mpt::match_what(AllOf(HasSubstr(generic_msg), HasSubstr(specific_info))));
Expand Down
22 changes: 11 additions & 11 deletions tests/qemu/linux/test_dnsmasq_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,46 +125,46 @@ TEST_F(DNSMasqServer, returns_null_ip_when_leases_file_does_not_exist)

TEST_F(DNSMasqServer, release_mac_releases_ip)
{
const QString dchp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};
const QString dhcp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};

mp::DNSMasqServer dns{data_dir.path(), dchp_release_called, subnet};
mp::DNSMasqServer dns{data_dir.path(), dhcp_release_called, subnet};
make_lease_entry();

dns.release_mac(hw_addr);

EXPECT_TRUE(QFile::exists(dchp_release_called));
EXPECT_TRUE(QFile::exists(dhcp_release_called));
}

TEST_F(DNSMasqServer, release_mac_logs_failure_on_missing_ip)
{
const QString dchp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};
const QString dhcp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};

mp::DNSMasqServer dns{data_dir.path(), dchp_release_called, subnet};
mp::DNSMasqServer dns{data_dir.path(), dhcp_release_called, subnet};
dns.release_mac(hw_addr);

EXPECT_FALSE(QFile::exists(dchp_release_called));
EXPECT_FALSE(QFile::exists(dhcp_release_called));
EXPECT_TRUE(logger->logged_lines.size() > 0);
}

TEST_F(DNSMasqServer, release_mac_logs_failures)
{
const QString dchp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called.fail")};
const QString dhcp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called.fail")};

mp::DNSMasqServer dns{data_dir.path(), dchp_release_called, subnet};
mp::DNSMasqServer dns{data_dir.path(), dhcp_release_called, subnet};
make_lease_entry();

dns.release_mac(hw_addr);

EXPECT_TRUE(QFile::exists(dchp_release_called));
EXPECT_TRUE(QFile::exists(dhcp_release_called));
EXPECT_TRUE(logger->logged_lines.size() > 0);
}

TEST_F(DNSMasqServer, release_mac_crashes_logs_failure)
{
const QString dchp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};
const QString dhcp_release_called{QDir{data_dir.path()}.filePath("dhcp_release_called")};
const std::string crash_hw_addr{"00:00:00:00:00:00"};

mp::DNSMasqServer dns{data_dir.path(), dchp_release_called, subnet};
mp::DNSMasqServer dns{data_dir.path(), dhcp_release_called, subnet};
make_lease_entry(crash_hw_addr);

dns.release_mac(crash_hw_addr);
Expand Down
6 changes: 3 additions & 3 deletions tests/reset_process_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace mpt = multipass::test;

namespace
{
class ResetableProcessFactory : public mp::ProcessFactory
class ResettableProcessFactory : public mp::ProcessFactory
{
public:
static void Reset()
Expand All @@ -36,10 +36,10 @@ class ResetableProcessFactory : public mp::ProcessFactory

mpt::ResetProcessFactory::ResetProcessFactory()
{
ResetableProcessFactory::Reset();
ResettableProcessFactory::Reset();
}

mpt::ResetProcessFactory::~ResetProcessFactory()
{
ResetableProcessFactory::Reset();
ResettableProcessFactory::Reset();
}
6 changes: 3 additions & 3 deletions tests/reset_process_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
*/

#ifndef MULTIPASS_RESETABLE_PROCESS_FACTORY_H
#define MULTIPASS_RESETABLE_PROCESS_FACTORY_H
#ifndef MULTIPASS_RESETTABLE_PROCESS_FACTORY_H
#define MULTIPASS_RESETTABLE_PROCESS_FACTORY_H

#include "process_factory.h" // rely on build system to include the right implementation

Expand All @@ -35,4 +35,4 @@ struct ResetProcessFactory
} // namespace test
} // namespace multipass

#endif // MULTIPASS_RESETABLE_PROCESS_FACTORY_H
#endif // MULTIPASS_RESETTABLE_PROCESS_FACTORY_H
8 changes: 4 additions & 4 deletions tests/test_alias_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST_F(AliasDictionary, SkipsCorrectlyBrokenEntries)
// In old versions, the file did not contain the `working-directory` flag in the JSON, because the
// `--no-working-directory` flag were not yet introduced. In case the file was generated by an old version,
// the flag must be `false`, in order to maintain backwards compatibility.
TEST_F(AliasDictionary, mapDirMissingTraslatesToDefault)
TEST_F(AliasDictionary, mapDirMissingTranslatesToDefault)
{
std::string file_contents{"{\n"
" \"alias3\": {\n"
Expand All @@ -203,7 +203,7 @@ TEST_F(AliasDictionary, mapDirMissingTraslatesToDefault)
ASSERT_EQ(a3->working_directory, "default");
}

TEST_F(AliasDictionary, mapDirEmptyStringTraslatesToDefault)
TEST_F(AliasDictionary, mapDirEmptyStringTranslatesToDefault)
{
std::string file_contents{"{\n"
" \"alias4\": {\n"
Expand Down Expand Up @@ -901,7 +901,7 @@ TEST_F(AliasDictionary, qualifiedGetContextAndAliasWorksIfContextDoesNotExist)
mp::AliasDict dict(&trash_term);

dict.add_alias("first_alias", mp::AliasDefinition{"instance-1", "command-1", "map"});
ASSERT_EQ(dict.get_context_and_alias("nonexistant_context.first_alias"), std::nullopt);
ASSERT_EQ(dict.get_context_and_alias("nonexistent_context.first_alias"), std::nullopt);
}

TEST_F(AliasDictionary, qualifiedGetContextAndAliasWorksIfAliasDoesNotExist)
Expand All @@ -911,7 +911,7 @@ TEST_F(AliasDictionary, qualifiedGetContextAndAliasWorksIfAliasDoesNotExist)
mp::AliasDict dict(&trash_term);

dict.add_alias("first_alias", mp::AliasDefinition{"instance-1", "command-1", "map"});
ASSERT_EQ(dict.get_context_and_alias("default.nonexistant_alias"), std::nullopt);
ASSERT_EQ(dict.get_context_and_alias("default.nonexistent_alias"), std::nullopt);
}

} // namespace
2 changes: 1 addition & 1 deletion tests/test_base_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ TEST_F(TestBaseSnapshot, adoptsExtraInterfacesFromJson)
EXPECT_EQ(snapshot.get_extra_interfaces(), extra_interfaces);
}

TEST_F(TestBaseSnapshot, doesNotComplainOnLegacyShapshot)
TEST_F(TestBaseSnapshot, doesNotComplainOnLegacySnapshot)
{
auto json = test_legacy_snapshot_json();

Expand Down
2 changes: 1 addition & 1 deletion tests/test_base_virtual_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ TEST_F(BaseVM, restoresSnapshotsWithExtraInterfaceDiff)
EXPECT_CALL(snapshot, get_mounts).WillOnce(ReturnRef(original_specs.mounts));
EXPECT_CALL(snapshot, get_metadata).WillOnce(ReturnRef(original_specs.metadata));

// set the behavior of get_extra_interfaces to cause the difference to the new spece extra interfaces
// set the behavior of get_extra_interfaces to cause the difference to the new space extra interfaces
EXPECT_CALL(snapshot, get_extra_interfaces).Times(3).WillRepeatedly(Return(original_specs.extra_interfaces));

EXPECT_CALL(*mock_cloud_init_file_ops_injection.first,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base_virtual_machine_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TEST_F(BaseFactory, networks_throws)
}

// Ideally, we'd define some unique YAML for each node and test the contents of the ISO image,
// but we'd need a cross-platfrom library to read files in an ISO image and that is beyond scope
// but we'd need a cross-platform library to read files in an ISO image and that is beyond scope
// at this time. Instead, just make sure an ISO image is created and has the expected path.
TEST_F(BaseFactory, creates_cloud_init_iso_image)
{
Expand Down Expand Up @@ -206,7 +206,7 @@ TEST_F(BaseFactory, prepareInterfaceLeavesExistingBridgeAlone)
EXPECT_EQ(extra_net, extra_copy);
}

TEST_F(BaseFactory, prepareInterfaceReplacesBridgedNetworkWithCorrespongingBridge)
TEST_F(BaseFactory, prepareInterfaceReplacesBridgedNetworkWithCorrespondingBridge)
{
StrictMock<MockBaseFactory> factory;
constexpr auto bridge_type = "tunnel";
Expand Down
8 changes: 4 additions & 4 deletions tests/test_blueprint_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ TEST_F(VMBlueprintProvider, givenDiskSpaceLessThanMinimumThrows)
mpt::match_what(AllOf(HasSubstr("Disk space"), HasSubstr("25G"))));
}

TEST_F(VMBlueprintProvider, higherOptionsIsNotOverriden)
TEST_F(VMBlueprintProvider, higherOptionsIsNotOverridden)
{
mp::DefaultVMBlueprintProvider blueprint_provider{blueprints_zip_url, &url_downloader, cache_dir.path(),
default_ttl};
Expand Down Expand Up @@ -702,23 +702,23 @@ TEST_F(VMBlueprintProvider, v2WithNoUrlKeyNotAdded)
EXPECT_EQ(blueprint_provider.info_for("no-url"), std::nullopt);
}

TEST_F(VMBlueprintProvider, v2MininalDefinitionAdded)
TEST_F(VMBlueprintProvider, v2MinimalDefinitionAdded)
{
mp::DefaultVMBlueprintProvider blueprint_provider{blueprints_zip_url, &url_downloader, cache_dir.path(),
default_ttl, "multivacs"};

EXPECT_NO_THROW(blueprint_provider.info_for("minimal"));
}

TEST_F(VMBlueprintProvider, v2MininalDefinitionWithShaOnUrlAdded)
TEST_F(VMBlueprintProvider, v2MinimalDefinitionWithShaOnUrlAdded)
{
mp::DefaultVMBlueprintProvider blueprint_provider{blueprints_zip_url, &url_downloader, cache_dir.path(),
default_ttl, "multivacs"};

EXPECT_NO_THROW(blueprint_provider.info_for("minimal-with-sha256-url"));
}

TEST_F(VMBlueprintProvider, v2MininalDefinitionWithHardcodedShaAdded)
TEST_F(VMBlueprintProvider, v2MinimalDefinitionWithHardcodedShaAdded)
{
mp::DefaultVMBlueprintProvider blueprint_provider{blueprints_zip_url, &url_downloader, cache_dir.path(),
default_ttl, "multivacs"};
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cli_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ TEST_F(Client, start_cmd_launches_petenv_if_absent_among_others_present)
EXPECT_THAT(send_command(cmd), Eq(mp::ReturnCode::Ok));
}

TEST_F(Client, start_cmd_fails_if_petenv_if_absent_amont_others_absent)
TEST_F(Client, start_cmd_fails_if_petenv_if_absent_amount_others_absent)
{
std::vector<std::string> instances{"a", "b", "c", petenv_name, "xyz"}, cmd = concat({"start"}, instances);

Expand All @@ -2252,7 +2252,7 @@ TEST_F(Client, start_cmd_fails_if_petenv_if_absent_amont_others_absent)
EXPECT_THAT(send_command(cmd), Eq(mp::ReturnCode::CommandFail));
}

TEST_F(Client, start_cmd_fails_if_petenv_if_absent_amont_others_deleted)
TEST_F(Client, start_cmd_fails_if_petenv_if_absent_amount_others_deleted)
{
std::vector<std::string> instances{"nope", petenv_name}, cmd = concat({"start"}, instances);

Expand Down Expand Up @@ -2454,7 +2454,7 @@ TEST_F(Client, stop_cmd_fails_with_time_suffix)
EXPECT_THAT(send_command({"stop", "foo", "--time", "+10s"}), Eq(mp::ReturnCode::CommandLineError));
}

TEST_F(Client, stop_cmd_succeds_with_cancel)
TEST_F(Client, stop_cmd_succeeds_with_cancel)
{
EXPECT_CALL(mock_daemon, stop(_, _));
EXPECT_THAT(send_command({"stop", "foo", "--cancel"}), Eq(mp::ReturnCode::Ok));
Expand Down
8 changes: 4 additions & 4 deletions tests/test_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ TEST_F(Daemon, failed_restart_command_returns_fulfilled_promise)
{
mp::Daemon daemon{config_builder.build()};

auto nonexistant_instance = new mp::InstanceNames; // on heap as *Request takes ownership
nonexistant_instance->add_instance_name("nonexistant");
auto nonexistent_instance = new mp::InstanceNames; // on heap as *Request takes ownership
nonexistent_instance->add_instance_name("nonexistent");
mp::RestartRequest request;
request.set_allocated_instance_names(nonexistant_instance);
request.set_allocated_instance_names(nonexistent_instance);
std::promise<grpc::Status> status_promise;

daemon.restart(&request, nullptr, &status_promise);
Expand Down Expand Up @@ -1677,7 +1677,7 @@ constexpr auto deleted_template = R"(
"state": 1
}})";

TEST_F(Daemon, skips_over_instance_ghosts_in_db) // which will have been sometimes writen for purged instances
TEST_F(Daemon, skips_over_instance_ghosts_in_db) // which will have been sometimes written for purged instances
{
config_builder.vault = std::make_unique<NiceMock<mpt::MockVMImageVault>>();

Expand Down
6 changes: 3 additions & 3 deletions tests/test_daemon_find.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ TEST_F(DaemonFind, findWithoutForceUpdateCheckUpdateManifestsCall)

// only the daemon constructor invoke it once
EXPECT_CALL(*mock_image_host, update_manifests(false)).Times(1);
// overwrite the defaulty emplaced StubVMImageHost
// overwrite the default emplaced StubVMImageHost
config_builder.image_hosts[0] = std::move(mock_image_host);
const mp::Daemon daemon{config_builder.build()};

send_command({"find"});
}

TEST_F(DaemonFind, UpdateManifestsThrowTriggersTheFailedCaseEventHanlderOfAsyncPeriodicDownloadTask)
TEST_F(DaemonFind, UpdateManifestsThrowTriggersTheFailedCaseEventHandlerOfAsyncPeriodicDownloadTask)
{
auto mock_image_host = std::make_unique<NiceMock<mpt::MockImageHost>>();

Expand All @@ -279,7 +279,7 @@ TEST_F(DaemonFind, UpdateManifestsThrowTriggersTheFailedCaseEventHanlderOfAsyncP
const mp::Daemon daemon{config_builder.build()};

// need it because mp::Daemon destructor which destructs qfuture and qfuturewatcher does not wait the async task to
// finish. As a consquence, the event handler is not guaranteed to be called without send_command({"find"});
// finish. As a consequence, the event handler is not guaranteed to be called without send_command({"find"});
send_command({"find"});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_daemon_snapshot_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ TEST_F(TestDaemonRestore, failsOnMissingSnapshotName)
AllOf(HasSubstr("No such snapshot"), HasSubstr(mock_instance_name), HasSubstr(missing_snapshot_name)));
}

TEST_F(TestDaemonRestore, retoresSnapshotDirectlyIfDestructive)
TEST_F(TestDaemonRestore, restoresSnapshotDirectlyIfDestructive)
{
static constexpr auto* snapshot_name = "dodo";
mp::RestoreRequest request{};
Expand Down
Loading
Loading