merge Verification and Update statuses
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ibb9c1c9f9cb7e9cda18f4e8dddb31d57a12f0d90
diff --git a/test/bmc_update_mock.hpp b/test/bmc_update_mock.hpp
index 3db9221..296b513 100644
--- a/test/bmc_update_mock.hpp
+++ b/test/bmc_update_mock.hpp
@@ -16,7 +16,7 @@
public:
MOCK_METHOD0(triggerUpdate, bool());
MOCK_METHOD0(abortUpdate, void());
- MOCK_METHOD0(status, UpdateStatus());
+ MOCK_METHOD0(status, ActionStatus());
};
std::unique_ptr<UpdateInterface> CreateUpdateMock()
diff --git a/test/firmware_state_updatecompleted_unittest.cpp b/test/firmware_state_updatecompleted_unittest.cpp
index 95e0a32..7c26688 100644
--- a/test/firmware_state_updatecompleted_unittest.cpp
+++ b/test/firmware_state_updatecompleted_unittest.cpp
@@ -46,7 +46,7 @@
AttemptToOpenFilesReturnsFailureAfterSuccess)
{
/* In state updateCompleted a file is open, which means no others can be. */
- getToUpdateCompleted(UpdateStatus::success);
+ getToUpdateCompleted(ActionStatus::success);
auto blobsToOpen = handler->getBlobIds();
for (const auto& blob : blobsToOpen)
@@ -61,14 +61,14 @@
TEST_F(FirmwareHandlerUpdateCompletedTest,
CallingStatSessionAfterCompletedSuccessReturnsStateWithoutRechecking)
{
- getToUpdateCompleted(UpdateStatus::success);
+ getToUpdateCompleted(ActionStatus::success);
EXPECT_CALL(*updateMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -78,14 +78,14 @@
TEST_F(FirmwareHandlerUpdateCompletedTest,
CallingStatSessionAfterCompletedFailureReturnsStateWithoutRechecking)
{
- getToUpdateCompleted(UpdateStatus::failed);
+ getToUpdateCompleted(ActionStatus::failed);
EXPECT_CALL(*updateMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_updatepending_unittest.cpp b/test/firmware_state_updatepending_unittest.cpp
index 87df67d..00bdc2a 100644
--- a/test/firmware_state_updatepending_unittest.cpp
+++ b/test/firmware_state_updatepending_unittest.cpp
@@ -195,7 +195,7 @@
expectedMeta.size = 0;
expectedMeta.blobState = flags;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::unknown));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_updatestarted_unittest.cpp b/test/firmware_state_updatestarted_unittest.cpp
index e2348e4..6b55b4e 100644
--- a/test/firmware_state_updatestarted_unittest.cpp
+++ b/test/firmware_state_updatestarted_unittest.cpp
@@ -158,17 +158,17 @@
* stat(session) - this will trigger a check, and the state may change.
*/
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsRunningDoesNotChangeState)
+ CallStatChecksActionStatusReturnsRunningDoesNotChangeState)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::running));
+ .WillOnce(Return(ActionStatus::running));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::running));
+ static_cast<std::uint8_t>(ActionStatus::running));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -176,17 +176,17 @@
}
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsFailedChangesStateToCompleted)
+ CallStatChecksActionStatusReturnsFailedChangesStateToCompleted)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::failed));
+ .WillOnce(Return(ActionStatus::failed));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -194,17 +194,17 @@
}
TEST_F(FirmwareHandlerUpdateStartedTest,
- CallStatChecksUpdateStatusReturnsSuccessChangesStateToCompleted)
+ CallStatChecksActionStatusReturnsSuccessChangesStateToCompleted)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status())
- .WillOnce(Return(UpdateStatus::success));
+ .WillOnce(Return(ActionStatus::success));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(UpdateStatus::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_verificationcompleted_unittest.cpp b/test/firmware_state_verificationcompleted_unittest.cpp
index 3c9f34d..90338f0 100644
--- a/test/firmware_state_verificationcompleted_unittest.cpp
+++ b/test/firmware_state_verificationcompleted_unittest.cpp
@@ -59,14 +59,14 @@
* consistent behavior with verifyBlobId only added when closing the image
* or hash.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_FALSE(handler->canHandleBlob(updateBlobId));
}
TEST_F(FirmwareHandlerVerificationCompletedTest,
OnVerificationCompleteFailureUpdateBlobIdNotPresent)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_FALSE(handler->canHandleBlob(updateBlobId));
}
@@ -75,7 +75,7 @@
*/
TEST_F(FirmwareHandlerVerificationCompletedTest, GetBlobIdsReturnsExpectedList)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::string> expected = {verifyBlobId, hashBlobId,
activeImageBlobId, staticLayoutBlobId};
EXPECT_THAT(handler->getBlobIds(), UnorderedElementsAreArray(expected));
@@ -87,7 +87,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
StatOnActiveImageReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_TRUE(handler->canHandleBlob(activeImageBlobId));
blobs::BlobMeta meta;
@@ -100,7 +100,7 @@
/* The path taken to get to this state never opened the hash blob Id, which
* is fine. But let's verify it behaved as intended.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_FALSE(handler->canHandleBlob(activeHashBlobId));
}
@@ -113,7 +113,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest, StatOnVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_TRUE(handler->canHandleBlob(verifyBlobId));
blobs::BlobMeta meta;
@@ -123,7 +123,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
StatOnNormalBlobsReturnsSuccess)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
blobs::BlobMeta expected;
expected.blobState = FirmwareBlobHandler::UpdateFlags::ipmi;
@@ -150,14 +150,14 @@
/* Every time you stat() once it's triggered, it checks the state again
* until it's completed.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_CALL(*verifyMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -167,14 +167,14 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
SessionStatOnVerifyAfterFailureDoesNothing)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_CALL(*verifyMockPtr, status()).Times(0);
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -187,7 +187,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
OpeningAnyBlobAvailableFailsAfterSuccess)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
auto blobs = handler->getBlobIds();
for (const auto& blob : blobs)
@@ -199,7 +199,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
OpeningAnyBlobAvailableFailsAfterFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
auto blobs = handler->getBlobIds();
for (const auto& blob : blobs)
@@ -214,7 +214,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
WriteMetaToVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::uint8_t> bytes = {0x01, 0x02};
EXPECT_FALSE(handler->writeMeta(session, 0, bytes));
@@ -226,7 +226,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
WriteToVerifyBlobReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
std::vector<std::uint8_t> bytes = {0x01, 0x02};
EXPECT_FALSE(handler->write(session, 0, bytes));
@@ -237,7 +237,7 @@
*/
TEST_F(FirmwareHandlerVerificationCompletedTest, ReadOfVerifyBlobReturnsEmpty)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_THAT(handler->read(session, 0, 1), IsEmpty());
}
@@ -250,7 +250,7 @@
/* If you've started this'll return success, but if it's finished, it won't
* let you try-again.
*/
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
EXPECT_CALL(*verifyMockPtr, triggerVerification()).Times(0);
EXPECT_FALSE(handler->commit(session, {}));
@@ -259,7 +259,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
CommitOnVerifyBlobAfterFailureReturnsFailure)
{
- getToVerificationCompleted(VerifyCheckResponses::failed);
+ getToVerificationCompleted(ActionStatus::failed);
EXPECT_CALL(*verifyMockPtr, triggerVerification()).Times(0);
EXPECT_FALSE(handler->commit(session, {}));
@@ -272,7 +272,7 @@
TEST_F(FirmwareHandlerVerificationCompletedTest,
CloseAfterSuccessChangesStateAddsUpdateBlob)
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
ASSERT_FALSE(handler->canHandleBlob(updateBlobId));
handler->close(session);
diff --git a/test/firmware_state_verificationpending_unittest.cpp b/test/firmware_state_verificationpending_unittest.cpp
index b96ecb3..d22b887 100644
--- a/test/firmware_state_verificationpending_unittest.cpp
+++ b/test/firmware_state_verificationpending_unittest.cpp
@@ -216,7 +216,7 @@
expectedMeta.size = 0;
expectedMeta.blobState = flags;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::other));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_state_verificationstarted_unittest.cpp b/test/firmware_state_verificationstarted_unittest.cpp
index e031fe3..03ceb99 100644
--- a/test/firmware_state_verificationstarted_unittest.cpp
+++ b/test/firmware_state_verificationstarted_unittest.cpp
@@ -71,13 +71,13 @@
{
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::running));
+ .WillOnce(Return(ActionStatus::running));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::running));
+ static_cast<std::uint8_t>(ActionStatus::running));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -88,13 +88,13 @@
{
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::other));
+ .WillOnce(Return(ActionStatus::unknown));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committing;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::other));
+ static_cast<std::uint8_t>(ActionStatus::unknown));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -108,13 +108,13 @@
*/
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::failed));
+ .WillOnce(Return(ActionStatus::failed));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::commit_error;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::failed));
+ static_cast<std::uint8_t>(ActionStatus::failed));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
@@ -129,13 +129,13 @@
*/
getToVerificationStarted(staticLayoutBlobId);
EXPECT_CALL(*verifyMockPtr, status())
- .WillOnce(Return(VerifyCheckResponses::success));
+ .WillOnce(Return(ActionStatus::success));
blobs::BlobMeta meta, expectedMeta = {};
expectedMeta.size = 0;
expectedMeta.blobState = flags | blobs::StateFlags::committed;
expectedMeta.metadata.push_back(
- static_cast<std::uint8_t>(VerifyCheckResponses::success));
+ static_cast<std::uint8_t>(ActionStatus::success));
EXPECT_TRUE(handler->stat(session, &meta));
EXPECT_EQ(expectedMeta, meta);
diff --git a/test/firmware_unittest.hpp b/test/firmware_unittest.hpp
index 947c2ba..11d49bf 100644
--- a/test/firmware_unittest.hpp
+++ b/test/firmware_unittest.hpp
@@ -75,7 +75,7 @@
expectedState(FirmwareBlobHandler::UpdateState::verificationStarted);
}
- void getToVerificationCompleted(VerifyCheckResponses checkResponse)
+ void getToVerificationCompleted(ActionStatus checkResponse)
{
getToVerificationStarted(staticLayoutBlobId);
@@ -87,7 +87,7 @@
void getToUpdatePending()
{
- getToVerificationCompleted(VerifyCheckResponses::success);
+ getToVerificationCompleted(ActionStatus::success);
handler->close(session);
expectedState(FirmwareBlobHandler::UpdateState::updatePending);
@@ -103,7 +103,7 @@
expectedState(FirmwareBlobHandler::UpdateState::updateStarted);
}
- void getToUpdateCompleted(UpdateStatus result)
+ void getToUpdateCompleted(ActionStatus result)
{
getToUpdateStarted();
EXPECT_CALL(*updateMockPtr, status()).WillOnce(Return(result));
diff --git a/test/tools_updater_unittest.cpp b/test/tools_updater_unittest.cpp
index 95a5abc..cacf2b0 100644
--- a/test/tools_updater_unittest.cpp
+++ b/test/tools_updater_unittest.cpp
@@ -130,7 +130,7 @@
verificationResponse.blob_state = supported | blobs::StateFlags::committing;
verificationResponse.size = 0;
verificationResponse.metadata.push_back(static_cast<std::uint8_t>(
- ipmi_flash::FirmwareBlobHandler::VerifyCheckResponses::success));
+ ipmi_flash::FirmwareBlobHandler::ActionStatus::success));
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
diff --git a/test/verification_mock.hpp b/test/verification_mock.hpp
index b3071ef..728411b 100644
--- a/test/verification_mock.hpp
+++ b/test/verification_mock.hpp
@@ -16,7 +16,7 @@
public:
MOCK_METHOD0(triggerVerification, bool());
MOCK_METHOD0(abortVerification, void());
- MOCK_METHOD0(status, VerifyCheckResponses());
+ MOCK_METHOD0(status, ActionStatus());
};
std::unique_ptr<VerificationInterface> CreateVerifyMock()