version_handler: Don't store session information immediately
This can cause spurious trigger aborts when open's fail and cleanup is
called on the failed session.
Change-Id: I1c49f248b6f56bbecc0d51fafaabe871d23b1d7d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/version-handler/test/version_close_unittest.cpp b/bmc/version-handler/test/version_close_unittest.cpp
index 83b4a43..c529206 100644
--- a/bmc/version-handler/test/version_close_unittest.cpp
+++ b/bmc/version-handler/test/version_close_unittest.cpp
@@ -31,9 +31,8 @@
TEST_F(VersionCloseExpireBlobTest, VerifyOpenThenClose)
{
EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true));
- EXPECT_CALL(*tm.at("blob0"), status())
- .WillOnce(Return(ActionStatus::success));
EXPECT_TRUE(h->open(0, blobs::read, "blob0"));
+ EXPECT_CALL(*tm.at("blob0"), abort()).Times(1);
EXPECT_TRUE(h->close(0));
}
@@ -45,9 +44,8 @@
TEST_F(VersionCloseExpireBlobTest, VerifyDoubleCloseFails)
{
EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true));
- EXPECT_CALL(*tm.at("blob0"), status())
- .WillOnce(Return(ActionStatus::success));
EXPECT_TRUE(h->open(0, blobs::read, "blob0"));
+ EXPECT_CALL(*tm.at("blob0"), abort()).Times(1);
EXPECT_TRUE(h->close(0));
EXPECT_FALSE(h->close(0));
}
@@ -55,20 +53,17 @@
TEST_F(VersionCloseExpireBlobTest, VerifyBadSessionNumberCloseFails)
{
EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true));
- EXPECT_CALL(*tm.at("blob0"), status())
- .WillOnce(Return(ActionStatus::success));
EXPECT_TRUE(h->open(0, blobs::read, "blob0"));
EXPECT_FALSE(h->close(1));
+ EXPECT_CALL(*tm.at("blob0"), abort()).Times(1);
EXPECT_TRUE(h->close(0));
}
TEST_F(VersionCloseExpireBlobTest, VerifyRunningActionIsAborted)
{
EXPECT_CALL(*tm.at("blob0"), trigger()).WillOnce(Return(true));
- EXPECT_CALL(*tm.at("blob0"), status())
- .WillOnce(Return(ActionStatus::running));
- EXPECT_CALL(*tm.at("blob0"), abort()).Times(1);
EXPECT_TRUE(h->open(0, blobs::read, "blob0"));
+ EXPECT_CALL(*tm.at("blob0"), abort()).Times(1);
EXPECT_TRUE(h->close(0));
}