Skip to content
Snippets Groups Projects
Commit 3b33dbb1 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[cta-taped] Set the reason of a drive at creation time: [cta-taped] INFO Drive created.

parent 915a5298
Branches
Tags
No related merge requests found
......@@ -60,6 +60,7 @@ void DriveState::initialize(const std::string & driveName) {
cta::common::dataStructures::DriveState driveState;
driveState.driveName = driveName;
driveState.downOrUpStartTime = ::time(nullptr);
driveState.desiredDriveState.setReasonFromLogMsg(cta::log::INFO,"Drive created.");
setState(driveState);
// This object is good to go (to storage)
m_payloadInterpreted = true;
......
......@@ -240,15 +240,19 @@ TEST_P(OStoreDBTest, setDesiredState){
OStoreDBWrapperInterface & osdbi = getDb();
AgentReference & agentRef = osdbi.getAgentReference();
//Create the drive first
std::string expectedReason = cta::common::dataStructures::DesiredDriveState::c_tpsrvPrefixComment + " INFO Drive created.";
std::string driveName = "DRIVE";
{
DriveState ds(osdbi.getBackend());
ScopedExclusiveLock dsl;
Helpers::getLockedAndFetchedDriveState(ds, dsl, agentRef, driveName, lc);
//Check the reason is set
ASSERT_EQ(expectedReason,ds.getState().desiredDriveState.reason.value());
}
cta::common::dataStructures::DesiredDriveState desiredState;
desiredState.up = false;
desiredState.up = true;
desiredState.forceDown = false;
desiredState.reason = "";
cta::common::dataStructures::DriveState driveState;
{
//Test the reason and comment fields are empty
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment