Skip to content

Commit

Permalink
Merge branch 'next' into feature/native-core-sdk-unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ksentak committed Sep 27, 2024
2 parents 24e2020 + e1f846a commit 9436e4c
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types:
- "completed"
workflows:
- "Core SDK - MFOS standalone sanity report"
- "MFOS standalone sanity report - CORE,MANAGE,DISCOVERY"

jobs:
comment-on-pr:
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/run-standalone-mfos-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Core SDK - MFOS standalone sanity report
name: MFOS standalone sanity report - CORE,MANAGE,DISCOVERY

on:
pull_request:
Expand All @@ -14,14 +14,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Run tests and create assets
#Run tests
- name: Run Core Manage and Discovery tests and create assets
env:
EVENT_NAME: ${{ github.event_name }}
GITHUB_REF: ${{ github.ref }}
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
INTENT: ${{ secrets.INTENT }}
INTENT: ${{ vars.INTENT }}
run: |
./.github/workflows/utils.sh runTests
./.github/workflows/utils.sh runTests
- name: Upload report.json as an artifact
uses: actions/upload-artifact@v4
Expand All @@ -31,4 +32,7 @@ jobs:

- name: Get results from report.json
run: |
./.github/workflows/utils.sh getResults
./.github/workflows/utils.sh getResults
4 changes: 2 additions & 2 deletions .github/workflows/utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ async function createComment(github, context) {
const { issue_number, Passes, Failures, Pending, Skipped, ARTIFACT_URL, JOB_PATH } = process.env;

const body = `
Core SDK - MFOS standalone sanity report:
Passes - ${Passes} Failures - ${Failures} Pending - ${Pending} Skipped - ${Skipped}
MFOS standalone sanity report - CORE,MANAGE,DISCOVERY:
Total Passes - ${Passes} Failures - ${Failures} Pending - ${Pending} Skipped - ${Skipped}
Report JSON/HTML Files: ${ARTIFACT_URL}
Job Logs: ${JOB_PATH}
`;
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ function runTests(){
echo "clone fca repo and start it in the background"
git clone --branch main https://github.com/rdkcentral/firebolt-certification-app.git
cd firebolt-certification-app
echo "Updating Core SDK dependency"
jq '.dependencies["@firebolt-js/sdk"] = "file:../firebolt-apis/src/sdks/core"' package.json > package.json.tmp && mv package.json.tmp package.json
echo "Updating Manage SDK dependency"
jq '.dependencies["@firebolt-js/manage-sdk"] = "file:../firebolt-apis/src/sdks/manage"' package.json > package.json.tmp && mv package.json.tmp package.json
echo "Updating Discovery SDK dependency"
jq '.dependencies["@firebolt-js/discovery-sdk"] = "file:../firebolt-apis/src/sdks/discovery"' package.json > package.json.tmp && mv package.json.tmp package.json
npm install
npm start &
sleep 5s
Expand Down Expand Up @@ -149,7 +154,7 @@ function unzipArtifact(){

# Check argument and call corresponding function
if [ "$1" == "runTests" ]; then
runTests
runTests
elif [ "$1" == "getResults" ]; then
getResults
elif [ "$1" == "getArtifactData" ]; then
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# [1.5.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.4.1-next.1...v1.5.0-next.1) (2024-09-25)


### Features

* Add native discovery test app ([#324](https://github.com/rdkcentral/firebolt-apis/issues/324)) ([93bc083](https://github.com/rdkcentral/firebolt-apis/commit/93bc083f76fc03c95c6f7c595259e3c78e7436f7))

## [1.4.1-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.4.0...v1.4.1-next.1) (2024-09-25)


### Bug Fixes

* Add Manage,Discovery to end-to-end Functional Testing ([#318](https://github.com/rdkcentral/firebolt-apis/issues/318)) ([41fdf27](https://github.com/rdkcentral/firebolt-apis/commit/41fdf2777183d85a5cdeb86874ec94ce3a6a3fe4))

# [1.4.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0...v1.4.0) (2024-09-23)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/sdks",
"version": "1.4.0",
"version": "1.5.0-next.1",
"description": "The Firebolt JS SDK",
"type": "module",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/sdk",
"version": "1.4.0",
"version": "1.5.0-next.1",
"description": "The Firebolt JS SDK",
"main": "./dist/lib/firebolt.mjs",
"types": "./dist/lib/firebolt.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/discovery-sdk",
"version": "1.4.0",
"version": "1.5.0-next.1",
"description": "The Firebolt Discovery JS SDK",
"main": "./dist/lib/firebolt-discovery.mjs",
"types": "./dist/lib/firebolt-discovery.d.ts",
Expand Down
40 changes: 37 additions & 3 deletions src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

using namespace std;
bool DiscoverySDKTest::_connected;
DiscoverySDKTest::OnUserInterestNotification DiscoverySDKTest::_userInterestNotification;

void DiscoverySDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error)
{
Expand Down Expand Up @@ -89,14 +90,47 @@ inline const T ConvertToEnum(EnumMap<T> enumMap, const string& str)
return value;
}

void DiscoverySDKTest::SampleTest()
void DiscoverySDKTest::OnUserInterestNotification::onUserInterest( const Firebolt::Content::InterestEvent& interest)
{
cout << "User Interest changed notification" << endl;
}

void DiscoverySDKTest::SubscribeUserInterest()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ContentInterface().subscribe(_userInterestNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe Content.UserInterest is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("Subscribe Content.UserInterest failed. " + errorMessage);
}
}

void DiscoverySDKTest::UnsubscribeUserInterest()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ContentInterface().unsubscribe(_userInterestNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe Content.UserInterest is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("Unsubscribe Content.UserInterest failed." + errorMessage);
}
}

void DiscoverySDKTest::RequestUserInterest()
{
Firebolt::Discovery::InterestType type = Firebolt::Discovery::InterestType::INTEREST;
Firebolt::Discovery::InterestReason reason = Firebolt::Discovery::InterestReason::REACTION;
Firebolt::Error error = Firebolt::Error::None;

Firebolt::IFireboltAccessor::Instance().ContentInterface().requestUserInterest(type, reason, &error);

if (error == Firebolt::Error::None) {
cout << "Sample Test Passed!" << endl;
cout << "Content.requestuserInterest call is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("SampleTest failed. " + errorMessage);
throw std::runtime_error("Content.requestUserInterest failed." + errorMessage);
}
}
10 changes: 9 additions & 1 deletion src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "firebolt.h"

class DiscoverySDKTest {
class OnUserInterestNotification : public Firebolt::Content::IContent::IOnUserInterestNotification {
public:
void onUserInterest( const Firebolt::Content::InterestEvent& ) override;
};

public:
DiscoverySDKTest() = default;
Expand All @@ -31,11 +35,15 @@ class DiscoverySDKTest {
static void DestroyFireboltInstance();
static void TestDiscoveryStaticSDK();

static void SampleTest();
static void SubscribeUserInterest();
static void UnsubscribeUserInterest();
static void RequestUserInterest();

static bool WaitOnConnectionReady();

private:
static void ConnectionChanged(const bool, const Firebolt::Error);
static bool _connected;
static OnUserInterestNotification _userInterestNotification;

};
5 changes: 3 additions & 2 deletions src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ void RunAllTests() {

// Ensure the connection is ready before running tests
if (DiscoverySDKTest::WaitOnConnectionReady()) {
// Add tests here

runTest(DiscoverySDKTest::SampleTest, "SampleTest");
runTest(DiscoverySDKTest::SubscribeUserInterest, "SubscribeUserInterest");
runTest(DiscoverySDKTest::UnsubscribeUserInterest, "UnsubscribeUserInterest");
runTest(DiscoverySDKTest::RequestUserInterest, "RequestUserInterest");

if (allTestsPassed) {
cout << "============================" << endl;
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/manage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/manage-sdk",
"version": "1.4.0",
"version": "1.5.0-next.1",
"description": "The Firebolt Manage JS SDK",
"main": "./dist/lib/firebolt-manage.mjs",
"types": "./dist/lib/firebolt-manage.d.ts",
Expand Down

0 comments on commit 9436e4c

Please sign in to comment.