-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[orchdaemon]: Fixed sairedis record file rotation (#2299)
* [orchdaemon]: Fixed sairedis record file rotation * What I did Fix #8162 Moved sairedis record file rotation logic out of flush() to fix issue. Why I did it Sairedis record file was not releasing the file handle on rotation. This is because the file handle release was inside the flush() which was only being called if a select timeout was triggered. Moved the logic to its own function which is called in the start() loop. How I verified it Ran a script to fill log and verified that rotation was happening correctly. Signed-off-by: Bryan Crossland [email protected]
- Loading branch information
1 parent
b8ee07d
commit 24d29f1
Showing
8 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "orchdaemon.h" | ||
#include "dbconnector.h" | ||
#include <gtest/gtest.h> | ||
#include <gmock/gmock.h> | ||
#include "mock_sai_switch.h" | ||
|
||
extern sai_switch_api_t* sai_switch_api; | ||
sai_switch_api_t test_sai_switch; | ||
|
||
namespace orchdaemon_test | ||
{ | ||
|
||
using ::testing::_; | ||
using ::testing::Return; | ||
using ::testing::StrictMock; | ||
|
||
DBConnector appl_db("APPL_DB", 0); | ||
DBConnector state_db("STATE_DB", 0); | ||
DBConnector config_db("CONFIG_DB", 0); | ||
DBConnector counters_db("COUNTERS_DB", 0); | ||
|
||
class OrchDaemonTest : public ::testing::Test | ||
{ | ||
public: | ||
StrictMock<MockSaiSwitch> mock_sai_switch_; | ||
|
||
OrchDaemon* orchd; | ||
|
||
OrchDaemonTest() | ||
{ | ||
mock_sai_switch = &mock_sai_switch_; | ||
sai_switch_api = &test_sai_switch; | ||
sai_switch_api->get_switch_attribute = &mock_get_switch_attribute; | ||
sai_switch_api->set_switch_attribute = &mock_set_switch_attribute; | ||
|
||
orchd = new OrchDaemon(&appl_db, &config_db, &state_db, &counters_db); | ||
|
||
}; | ||
|
||
~OrchDaemonTest() | ||
{ | ||
|
||
}; | ||
}; | ||
|
||
TEST_F(OrchDaemonTest, logRotate) | ||
{ | ||
EXPECT_CALL(mock_sai_switch_, set_switch_attribute( _, _)).WillOnce(Return(SAI_STATUS_SUCCESS)); | ||
|
||
orchd->logRotate(); | ||
} | ||
} |