Skip to content

Commit

Permalink
[tests] Confirm logging of head snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ricab committed Dec 22, 2023
1 parent c2a7ede commit b3621bb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_base_virtual_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

#include "common.h"
#include "dummy_ssh_key_provider.h"
#include "mock_logger.h"
#include "mock_ssh_test_fixture.h"
#include "mock_virtual_machine.h"
#include "multipass/exceptions/snapshot_exceptions.h"
#include "multipass/logging/level.h"
#include "temp_dir.h"

#include <shared/base_virtual_machine.h>
Expand Down Expand Up @@ -478,6 +480,17 @@ TEST_F(BaseVM, providesSnapshotsByName)
EXPECT_THAT(vm.get_snapshot(target_name), Pointee(Property(&mp::Snapshot::get_name, Eq(target_name))));
}

TEST_F(BaseVM, logsSnapshotHead)
{
mock_named_snapshotting();
const auto name = "asdf";

auto logger_scope = mpt::MockLogger::inject(mpl::Level::debug);
logger_scope.mock_logger->expect_log(mpl::Level::debug, name);

vm.take_snapshot({}, name, "");
}

TEST_F(BaseVM, throwsOnMissingSnapshotByIndex)
{
mock_indexed_snapshotting();
Expand Down

0 comments on commit b3621bb

Please sign in to comment.