firmware: add expiration handle

Expiring the session aborts the process.

Tested: Only tested with unit-tests, not run on a real system.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I3a7ae54cfa04e162a2a1e591c0ddd4eca3d6d3db
diff --git a/bmc/test/firmware_state_verificationcompleted_unittest.cpp b/bmc/test/firmware_state_verificationcompleted_unittest.cpp
index f7b0998..f926223 100644
--- a/bmc/test/firmware_state_verificationcompleted_unittest.cpp
+++ b/bmc/test/firmware_state_verificationcompleted_unittest.cpp
@@ -307,5 +307,19 @@
                 UnorderedElementsAreArray(startingBlobs));
 }
 
+/*
+ * expire(session)
+ */
+TEST_F(FirmwareHandlerVerificationCompletedTest,
+       ExpireAfterVerificationCompletedAborts)
+{
+    getToVerificationCompleted(ActionStatus::failed);
+
+    ASSERT_TRUE(handler->expire(session));
+    expectedState(FirmwareBlobHandler::UpdateState::notYetStarted);
+    EXPECT_THAT(handler->getBlobIds(),
+                UnorderedElementsAreArray(startingBlobs));
+}
+
 } // namespace
 } // namespace ipmi_flash