bmc: verificationCompleted: close: handle failure
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I7efdc39998d4c61ec23af7eb5ed4062f0aedf190
diff --git a/test/firmware_state_verificationcompleted_unittest.cpp b/test/firmware_state_verificationcompleted_unittest.cpp
index ac3539d..0f02cf3 100644
--- a/test/firmware_state_verificationcompleted_unittest.cpp
+++ b/test/firmware_state_verificationcompleted_unittest.cpp
@@ -297,8 +297,19 @@
/*
* close(session) - close on the verify blobid:
- * TODO: 2. if unsuccessful doesn't add update blob id, changes state to?
+ * 2. if unsuccessful it aborts.
*/
+TEST_F(FirmwareHandlerVerificationCompletedTest, CloseAfterFailureAborts)
+{
+ getToVerificationCompleted(ActionStatus::failed);
+ ASSERT_FALSE(handler->canHandleBlob(updateBlobId));
+
+ handler->close(session);
+ ASSERT_FALSE(handler->canHandleBlob(updateBlobId));
+ expectedState(FirmwareBlobHandler::UpdateState::notYetStarted);
+ std::vector<std::string> expected = {staticLayoutBlobId, hashBlobId};
+ EXPECT_THAT(handler->getBlobIds(), UnorderedElementsAreArray(expected));
+}
} // namespace
} // namespace ipmi_flash