-
Notifications
You must be signed in to change notification settings - Fork 4
RTAUTO-53271:Add script to test maintenance mode functionality #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MohamedSameem97
wants to merge
24
commits into
rdkcentral:develop
Choose a base branch
from
MohamedSameem97:topic/RTAUTO-53271
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
046be19
Add script to test maintenance mode functionality
MohamedSameem97 ab2948c
Add script to test maintenance mode functionality
MohamedSameem97 c9ceb3c
Add script to manage maintenance mode in background
MohamedSameem97 16a963f
Add script to manage maintenance mode in foreground
MohamedSameem97 a3a1da6
Add maintenance mode opt-out test script
MohamedSameem97 8439369
Add test script for maintenance mode enforcement
MohamedSameem97 12e025b
Add script for maintenance mode critical update
MohamedSameem97 adeb98e
Fix permissions for maintenance.sh script
MohamedSameem97 b9ff8f9
Fix script formatting and update permissions command
MohamedSameem97 690173c
Fix script permissions for maintenance.sh
MohamedSameem97 07d552e
Fix permissions for maintenance.sh script
MohamedSameem97 e9a8e04
Update test_maintenanceMode_BACKGROUND_NONE.sh
MohamedSameem97 1040f55
Update test_maintenanceMode_FOREGROUND_NONE.sh
MohamedSameem97 3586ab6
Update test_maintenanceMode_BACKGROUND_IGNOREUPDATE.sh
MohamedSameem97 3269fac
Update test_maintenanceMode_FOREGROUND_IGNORE_UPDATE.sh
MohamedSameem97 11c058e
Update test_maintenanceMode_BACKGROUND_ENFORCE_OPTOUT.sh
MohamedSameem97 84021da
Update test_maintenanceMode_FOREGROUND_ENFORCE_OPTOUT.sh
MohamedSameem97 27c629b
Update test_maintenanceMode_criticalUpdate.sh
MohamedSameem97 7afbbc0
Update test_maintenanceMode_BACKGROUND_ENFORCE_OPTOUT.sh
MohamedSameem97 8af5c6c
Update test_maintenanceMode_BACKGROUND_IGNOREUPDATE.sh
MohamedSameem97 d3325c5
Update test_maintenanceMode_BACKGROUND_NONE.sh
MohamedSameem97 8393a05
Update test_maintenanceMode_FOREGROUND_ENFORCE_OPTOUT.sh
MohamedSameem97 6f71a05
Update test_maintenanceMode_FOREGROUND_IGNORE_UPDATE.sh
MohamedSameem97 4416517
Update test_maintenanceMode_FOREGROUND_NONE.sh
MohamedSameem97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
Tests/TestScripts/test_maintenanceMode_BACKGROUND_ENFORCE_OPTOUT.sh
This file contains hidden or 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,98 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| URL="http://127.0.0.1:9998/jsonrpc" | ||
| AUTH_HEADER="Authorization: Bearer" | ||
| LOG_FILE="/opt/logs/maintenance.log" | ||
|
|
||
| #Clear log file | ||
| > /opt/logs/maintenance.log | ||
|
|
||
| EXPECTED_MODE="BACKGROUND" | ||
| EXPECTED_OPTOUT="ENFORCE_OPTOUT" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 1. Set Maintenance Mode to BACKGROUND | ||
| # --------------------------------------------------------- | ||
| echo "STEP 1: Setting maintenance mode to BACKGROUND..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"org.rdk.MaintenanceManager.1.setMaintenanceMode\",\"params\":{\"maintenanceMode\":\"$EXPECTED_MODE\",\"optOut\":\"$EXPECTED_OPTOUT\"}}" \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2. Get & Verify Maintenance Mode | ||
| # --------------------------------------------------------- | ||
| echo "STEP 2: Getting maintenance mode..." | ||
|
|
||
| GET_RESPONSE=$(curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceMode","params":{}}' \ | ||
| "$URL") | ||
|
|
||
| echo "Response: $GET_RESPONSE" | ||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2A Verify GET_RESPONSE matches EXPECTED_MODE and EXPECTED_OPTOUT | ||
| # --------------------------------------------------------- | ||
|
|
||
| # Extract values from JSON response | ||
| REPORTED_MODE=$(echo "$GET_RESPONSE" | grep -o '"maintenanceMode":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
| REPORTED_OPTOUT=$(echo "$GET_RESPONSE" | grep -o '"optOut":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Extracted maintenanceMode: $REPORTED_MODE" | ||
| echo "Extracted optOut: $REPORTED_OPTOUT" | ||
|
|
||
| # Compare both values | ||
| if [[ "$REPORTED_MODE" == "$EXPECTED_MODE" ]] && [[ "$REPORTED_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "Verification: PASS — maintenanceMode and optOut match expected values." | ||
| else | ||
| echo "Verification: FAIL" | ||
| echo "Expected maintenanceMode: $EXPECTED_MODE, Got: $REPORTED_MODE" | ||
| echo "Expected optOut: $EXPECTED_OPTOUT, Got: $REPORTED_OPTOUT" | ||
| fi | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 3. Trigger Maintenance Mode | ||
| # Maintenance should not be running | ||
| # --------------------------------------------------------- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do add a comment that a running Maintenance is not a pre-condition of just add a pre-condition step and call stopMaintenance if needed |
||
| echo "STEP 3: Triggering startMaintenance..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.startMaintenance","params":{}}' \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 4. Verify Maintenance Mode in Log | ||
| # --------------------------------------------------------- | ||
| echo "STEP 4: Checking maintenance.log for maintenance entries" | ||
|
|
||
| if [[ -f "$LOG_FILE" ]]; then | ||
| sleep 5 | ||
|
|
||
| LOG_MODE=$(grep -o '"maintenanceMode":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
| LOG_OPTOUT=$(grep -o '"optOut":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Log maintenanceMode: $LOG_MODE" | ||
| echo "Log optOut: $LOG_OPTOUT" | ||
|
|
||
| if [[ "$LOG_MODE" == "$EXPECTED_MODE" ]] && [[ "$LOG_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "RESULT: PASS" | ||
| else | ||
| echo "RESULT: FAIL" | ||
| fi | ||
| else | ||
| echo "ERROR: Log file not found at $LOG_FILE" | ||
| fi | ||
98 changes: 98 additions & 0 deletions
98
Tests/TestScripts/test_maintenanceMode_BACKGROUND_IGNOREUPDATE.sh
This file contains hidden or 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,98 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| URL="http://127.0.0.1:9998/jsonrpc" | ||
| AUTH_HEADER="Authorization: Bearer" | ||
| LOG_FILE="/opt/logs/maintenance.log" | ||
|
|
||
| #Clear log file | ||
| > /opt/logs/maintenance.log | ||
|
|
||
| EXPECTED_MODE="BACKGROUND" | ||
| EXPECTED_OPTOUT="IGNORE_UPDATE" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 1. Set Maintenance Mode to BACKGROUND | ||
| # --------------------------------------------------------- | ||
| echo "STEP 1: Setting maintenance mode to BACKGROUND..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"org.rdk.MaintenanceManager.1.setMaintenanceMode\",\"params\":{\"maintenanceMode\":\"$EXPECTED_MODE\",\"optOut\":\"$EXPECTED_OPTOUT\"}}" \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2. Get & Verify Maintenance Mode | ||
| # --------------------------------------------------------- | ||
| echo "STEP 2: Getting maintenance mode..." | ||
|
|
||
| GET_RESPONSE=$(curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceMode","params":{}}' \ | ||
| "$URL") | ||
|
|
||
| echo "Response: $GET_RESPONSE" | ||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2A Verify GET_RESPONSE matches EXPECTED_MODE and EXPECTED_OPTOUT | ||
| # --------------------------------------------------------- | ||
|
|
||
| # Extract values from JSON response | ||
| REPORTED_MODE=$(echo "$GET_RESPONSE" | grep -o '"maintenanceMode":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
| REPORTED_OPTOUT=$(echo "$GET_RESPONSE" | grep -o '"optOut":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Extracted maintenanceMode: $REPORTED_MODE" | ||
| echo "Extracted optOut: $REPORTED_OPTOUT" | ||
|
|
||
| # Compare both values | ||
| if [[ "$REPORTED_MODE" == "$EXPECTED_MODE" ]] && [[ "$REPORTED_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "Verification: PASS — maintenanceMode and optOut match expected values." | ||
| else | ||
| echo "Verification: FAIL" | ||
| echo "Expected maintenanceMode: $EXPECTED_MODE, Got: $REPORTED_MODE" | ||
| echo "Expected optOut: $EXPECTED_OPTOUT, Got: $REPORTED_OPTOUT" | ||
| fi | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 3. Trigger Maintenance Mode | ||
| # Maintenance should not be running | ||
| # --------------------------------------------------------- | ||
| echo "STEP 3: Triggering startMaintenance..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.startMaintenance","params":{}}' \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 4. Verify Maintenance Mode in Log | ||
| # --------------------------------------------------------- | ||
| echo "STEP 4: Checking maintenance.log for maintenance entries" | ||
|
|
||
| if [[ -f "$LOG_FILE" ]]; then | ||
| sleep 5 | ||
|
|
||
| LOG_MODE=$(grep -o '"maintenanceMode":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
| LOG_OPTOUT=$(grep -o '"optOut":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Log maintenanceMode: $LOG_MODE" | ||
| echo "Log optOut: $LOG_OPTOUT" | ||
|
|
||
| if [[ "$LOG_MODE" == "$EXPECTED_MODE" ]] && [[ "$LOG_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "RESULT: PASS" | ||
| else | ||
| echo "RESULT: FAIL" | ||
| fi | ||
| else | ||
| echo "ERROR: Log file not found at $LOG_FILE" | ||
| fi |
This file contains hidden or 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,98 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| URL="http://127.0.0.1:9998/jsonrpc" | ||
| AUTH_HEADER="Authorization: Bearer" | ||
| LOG_FILE="/opt/logs/maintenance.log" | ||
|
|
||
| #Clear log file | ||
| > /opt/logs/maintenance.log | ||
|
|
||
| EXPECTED_MODE="BACKGROUND" | ||
| EXPECTED_OPTOUT="NONE" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 1. Set Maintenance Mode to BACKGROUND | ||
| # --------------------------------------------------------- | ||
| echo "STEP 1: Setting maintenance mode to BACKGROUND..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"org.rdk.MaintenanceManager.1.setMaintenanceMode\",\"params\":{\"maintenanceMode\":\"$EXPECTED_MODE\",\"optOut\":\"$EXPECTED_OPTOUT\"}}" \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2. Get & Verify Maintenance Mode | ||
| # --------------------------------------------------------- | ||
| echo "STEP 2: Getting maintenance mode..." | ||
|
|
||
| GET_RESPONSE=$(curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceMode","params":{}}' \ | ||
| "$URL") | ||
|
|
||
| echo "Response: $GET_RESPONSE" | ||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2A Verify GET_RESPONSE matches EXPECTED_MODE and EXPECTED_OPTOUT | ||
| # --------------------------------------------------------- | ||
|
|
||
| # Extract values from JSON response | ||
| REPORTED_MODE=$(echo "$GET_RESPONSE" | grep -o '"maintenanceMode":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
| REPORTED_OPTOUT=$(echo "$GET_RESPONSE" | grep -o '"optOut":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Extracted maintenanceMode: $REPORTED_MODE" | ||
| echo "Extracted optOut: $REPORTED_OPTOUT" | ||
|
|
||
| # Compare both values | ||
| if [[ "$REPORTED_MODE" == "$EXPECTED_MODE" ]] && [[ "$REPORTED_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "Verification: PASS — maintenanceMode and optOut match expected values." | ||
| else | ||
| echo "Verification: FAIL" | ||
| echo "Expected maintenanceMode: $EXPECTED_MODE, Got: $REPORTED_MODE" | ||
| echo "Expected optOut: $EXPECTED_OPTOUT, Got: $REPORTED_OPTOUT" | ||
| fi | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 3. Trigger Maintenance Mode | ||
| # Maintenance should not be running | ||
| # --------------------------------------------------------- | ||
| echo "STEP 3: Triggering startMaintenance..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.startMaintenance","params":{}}' \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 4. Verify Maintenance Mode in Log | ||
| # --------------------------------------------------------- | ||
| echo "STEP 4: Checking maintenance.log for maintenance entries" | ||
|
|
||
| if [[ -f "$LOG_FILE" ]]; then | ||
| sleep 5 | ||
|
|
||
| LOG_MODE=$(grep -o '"maintenanceMode":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
| LOG_OPTOUT=$(grep -o '"optOut":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Log maintenanceMode: $LOG_MODE" | ||
| echo "Log optOut: $LOG_OPTOUT" | ||
|
|
||
| if [[ "$LOG_MODE" == "$EXPECTED_MODE" ]] && [[ "$LOG_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "RESULT: PASS" | ||
| else | ||
| echo "RESULT: FAIL" | ||
| fi | ||
| else | ||
| echo "ERROR: Log file not found at $LOG_FILE" | ||
| fi |
98 changes: 98 additions & 0 deletions
98
Tests/TestScripts/test_maintenanceMode_FOREGROUND_ENFORCE_OPTOUT.sh
This file contains hidden or 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,98 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| URL="http://127.0.0.1:9998/jsonrpc" | ||
| AUTH_HEADER="Authorization: Bearer" | ||
| LOG_FILE="/opt/logs/maintenance.log" | ||
|
|
||
| #Clear log file | ||
| > /opt/logs/maintenance.log | ||
|
|
||
| EXPECTED_MODE="FOREGROUND" | ||
| EXPECTED_OPTOUT="ENFORCE_OPTOUT" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 1. Set Maintenance Mode to FOREGROUND | ||
| # --------------------------------------------------------- | ||
| echo "STEP 1: Setting maintenance mode to FOREGROUND..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d "{\"jsonrpc\":\"2.0\",\"id\":3,\"method\":\"org.rdk.MaintenanceManager.1.setMaintenanceMode\",\"params\":{\"maintenanceMode\":\"$EXPECTED_MODE\",\"optOut\":\"$EXPECTED_OPTOUT\"}}" \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2. Get & Verify Maintenance Mode | ||
| # --------------------------------------------------------- | ||
| echo "STEP 2: Getting maintenance mode..." | ||
|
|
||
| GET_RESPONSE=$(curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceMode","params":{}}' \ | ||
| "$URL") | ||
|
|
||
| echo "Response: $GET_RESPONSE" | ||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 2A Verify GET_RESPONSE matches EXPECTED_MODE and EXPECTED_OPTOUT | ||
| # --------------------------------------------------------- | ||
|
|
||
| # Extract values from JSON response | ||
| REPORTED_MODE=$(echo "$GET_RESPONSE" | grep -o '"maintenanceMode":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
| REPORTED_OPTOUT=$(echo "$GET_RESPONSE" | grep -o '"optOut":"[^"]*"' | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Extracted maintenanceMode: $REPORTED_MODE" | ||
| echo "Extracted optOut: $REPORTED_OPTOUT" | ||
|
|
||
| # Compare both values | ||
| if [[ "$REPORTED_MODE" == "$EXPECTED_MODE" ]] && [[ "$REPORTED_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "Verification: PASS — maintenanceMode and optOut match expected values." | ||
| else | ||
| echo "Verification: FAIL" | ||
| echo "Expected maintenanceMode: $EXPECTED_MODE, Got: $REPORTED_MODE" | ||
| echo "Expected optOut: $EXPECTED_OPTOUT, Got: $REPORTED_OPTOUT" | ||
| fi | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 3. Trigger Maintenance Mode | ||
| # Maintenance should not be running | ||
| # --------------------------------------------------------- | ||
| echo "STEP 3: Triggering startMaintenance..." | ||
|
|
||
| curl -H "$AUTH_HEADER" \ | ||
| -H "Content-Type: application/json" \ | ||
| --request POST --silent \ | ||
| -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.startMaintenance","params":{}}' \ | ||
| "$URL" | ||
|
|
||
| echo -e "\n" | ||
|
|
||
| # --------------------------------------------------------- | ||
| # 4. Verify Maintenance Mode in Log | ||
| # --------------------------------------------------------- | ||
| echo "STEP 4: Checking maintenance.log for maintenance entries" | ||
|
|
||
| if [[ -f "$LOG_FILE" ]]; then | ||
| sleep 5 | ||
|
|
||
| LOG_MODE=$(grep -o '"maintenanceMode":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
| LOG_OPTOUT=$(grep -o '"optOut":"[^"]*"' "$LOG_FILE" | tail -1 | cut -d':' -f2 | tr -d '"') | ||
|
|
||
| echo "Log maintenanceMode: $LOG_MODE" | ||
| echo "Log optOut: $LOG_OPTOUT" | ||
|
|
||
| if [[ "$LOG_MODE" == "$EXPECTED_MODE" ]] && [[ "$LOG_OPTOUT" == "$EXPECTED_OPTOUT" ]]; then | ||
| echo "RESULT: PASS" | ||
| else | ||
| echo "RESULT: FAIL" | ||
| fi | ||
| else | ||
| echo "ERROR: Log file not found at $LOG_FILE" | ||
| fi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we assert of the response has the EXPECTED_MODE here too?