Skip to content

Commit

Permalink
Merge pull request rdkcentral#5381 from srinibas104/sprint/24Q2
Browse files Browse the repository at this point in the history
Warehouse L2Test Usecase Scenarios
  • Loading branch information
srikanth-vv authored Jun 5, 2024
2 parents 3237958 + 488a94e commit e1af3cd
Show file tree
Hide file tree
Showing 7 changed files with 1,080 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ jobs:
-DCMAKE_DISABLE_FIND_PACKAGE_RBus=ON
-DPLUGIN_SYSTEMSERVICES=ON
-DPLUGIN_TELEMETRY=ON
-DPLUGIN_WAREHOUSE=ON
-DPLUGIN_HDCPPROFILE=ON
-DPLUGIN_NETWORK=ON
-DPLUGIN_TEXTTOSPEECH=ON
Expand Down Expand Up @@ -256,6 +257,7 @@ jobs:
/run/media/sda2/logs/PreviousLogs
/run/sda1/UsbTestFWUpdate
/run/sda1/UsbProdFWUpdate
/run/media/sda1/Logs
/run/sda2
&&
sudo touch
Expand All @@ -272,7 +274,8 @@ jobs:
/run/media/sda1/logs/test.png
/run/media/sda1/logs/test.docx
/run/media/sda2/logs/test.txt
/run/media/sda2/logs/test.png
/run/media/sda2/logs/test.png
/run/media/sda1/Logs/5C3400F15492_Logs_12-05-22-10-41PM.tgz
/run/sda1/HSTP11MWR_5.11p5s1_VBN_sdy.bin
/run/sda1/UsbTestFWUpdate/HSTP11MWR_3.11p5s1_VBN_sdy.bin
/run/sda1/UsbProdFWUpdate/HSTP11MWR_4.11p5s1_VBN_sdy.bin
Expand Down
1 change: 1 addition & 0 deletions Tests/L2Tests/L2TestsPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ add_library(${MODULE_NAME} SHARED
tests/SystemService_L2Test.cpp
tests/UsbAccess_L2Test.cpp
tests/Telemetry_L2Test.cpp
tests/Warehouse_L2Test.cpp
tests/VerifyContracts.cpp)

set_target_properties(${MODULE_NAME} PROPERTIES
Expand Down
9 changes: 0 additions & 9 deletions Tests/L2Tests/L2TestsPlugin/tests/Telemetry_L2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ JSONRPC::LinkType<Core::JSON::IElement> jsonrpc(TELEMETRY_CALLSIGN, TELEMETRYL2T
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;

/* Without params and with Params as "No status" expecting Fail case*/
status = InvokeServiceMethod("org.rdk.Telemetry.1", "setReportProfileStatus", params, result);
Expand Down Expand Up @@ -343,7 +342,6 @@ TEST_F(Telemetry_L2test, TelemetrylogApplicationEvent){
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;

/* Without params expecting Fail case*/
status = InvokeServiceMethod("org.rdk.Telemetry.1", "logApplicationEvent", params, result);
Expand Down Expand Up @@ -384,7 +382,6 @@ TEST_F(Telemetry_L2test, TelemetryAbortReport){
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;
struct _rbusObject rbObject;

status = InvokeServiceMethod("org.rdk.Telemetry.1", "abortReport", params, result);
Expand Down Expand Up @@ -451,8 +448,6 @@ TEST_F(Telemetry_L2test, TelemetryImplementationMock){
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;
struct _rbusObject rbObject;


EXPECT_CALL(*p_telemetryApiImplMock, t2_init(::testing::_))
Expand Down Expand Up @@ -520,8 +515,6 @@ TEST_F(Telemetry_L2test, TelemetryRbusOpeningErrorCheck){
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;
struct _rbusObject rbObject;

EXPECT_CALL(*p_rBusApiImplMock, rbus_open(::testing::_, ::testing::_))
.Times(2)
Expand Down Expand Up @@ -563,9 +556,7 @@ TEST_F(Telemetry_L2test, TelemetryReportUploadErrorCheck){
JsonObject result;
std::string message;
JsonObject expected_status;
uint32_t signalled = TELEMETRYL2TEST_STATE_INVALID;
struct _rbusObject rbObject;
struct _rbusValue rbValue;

ON_CALL(*p_rBusApiImplMock, rbus_open(::testing::_, ::testing::_))
.WillByDefault(
Expand Down
12 changes: 6 additions & 6 deletions Tests/L2Tests/L2TestsPlugin/tests/UsbAccess_L2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ TEST_F(UsbAccess_L2test,UsbAccessArchiveLogs)
static struct mntent entry1;

entry1.mnt_fsname = const_cast<char*>("/dev/sda1");
entry1.mnt_dir = const_cast<char*>("/run/media/sda1");
entry1.mnt_dir = const_cast<char*>("/run/media/sda1/Logs");

static int callCount = 0;
if (callCount == 0) {
Expand All @@ -596,9 +596,9 @@ TEST_F(UsbAccess_L2test,UsbAccessArchiveLogs)
va_copy(args2, args);
char strFmt[256];
vsnprintf(strFmt, sizeof(strFmt), command, args2);
va_end(args2);
if (strcmp(strFmt, "/lib/rdk/usbLogUpload.sh /run/media/sda1") == 0) {
valueToReturn = "/run/media/sda1/5C3400F15492_Logs_12-05-22-10-41PM.tgz";
va_end(args2);
if (strcmp(strFmt, "/lib/rdk/usbLogUpload.sh /run/media/sda1/Logs") == 0) {
valueToReturn = "/run/media/sda1/Logs/5C3400F15492_Logs_12-05-22-10-41PM.tgz";
}
if (valueToReturn != NULL) {
char buffer[1024];
Expand Down Expand Up @@ -626,7 +626,7 @@ TEST_F(UsbAccess_L2test,UsbAccessArchiveLogs)


/* Compresses and uploads device logs into attached USB drive */
params["path"] = "/run/media/sda1";
params["path"] = "/run/media/sda1/Logs";
params["error"] = "none";
params["success"] = "true";
status = InvokeServiceMethod("org.rdk.UsbAccess.1", "ArchiveLogs", params, result);
Expand All @@ -635,7 +635,7 @@ TEST_F(UsbAccess_L2test,UsbAccessArchiveLogs)

/* Request status for onArchive. */

message = "{\"error\":\"none\",\"success\":true,\"path\":\"\\/run\\/media\\/sda1\\/5C3400F15492_Logs_12-05-22-10-41PM.tgz\"}";
message = "{\"error\":\"none\",\"success\":true,\"path\":\"\\/run\\/media\\/sda1\\/Logs\\/5C3400F15492_Logs_12-05-22-10-41PM.tgz\"}";
expected_status.FromString(message);
EXPECT_CALL(async_handler, onArchiveLogs(MatchRequestStatus(expected_status)))
.WillOnce(Invoke(this, &UsbAccess_L2test::onArchiveLogs));
Expand Down
Loading

0 comments on commit e1af3cd

Please sign in to comment.