Skip to content

User/ujsrivastava/block unblock device test spec#672

Merged
ASPS002 merged 10 commits intomainfrom
user/ujsrivastava/block_unblock_device_test_spec
Mar 3, 2025
Merged

User/ujsrivastava/block unblock device test spec#672
ASPS002 merged 10 commits intomainfrom
user/ujsrivastava/block_unblock_device_test_spec

Conversation

@ASPS002
Copy link
Collaborator

@ASPS002 ASPS002 commented Feb 19, 2025

Description

This Pull Request adds two properties to the requestHydraLabTest test configuation for blocking and unblocking a device on which the test runs.

Blocking a device by a task
Input:
A boolean property blockDevice needs to be provided in the requestHydraLabTest Gradle task input. When it is passed as true, the deviceIdentifier passed in the task is blocked as follows:

  • If the deviceeIdentifier corresponds to a device group, then it blocks any one of the available online unblocked devices from the device group and the test runs on that device.
  • If the deviceIdentifier corresponds to a specific device, then it blocks that specific device and the test runs on that specific device.

Output:

  • Outputs BlockedDeviceSerialNumber that can be used in the next task and used for further task runs on the same device or any further actions.
  • Outputs UnblockDeviceSecretKey that can be used in the next task in which you want to unblock the device usinig this secret key.

Unblocking a device by a task
Input:
A boolean property unblockDevice and unblockDeviceSecretKey needs to be provided in the requestHydraLabTest Gradle task input. When the unblockDevice is passed as true and unblockDeviceSecretKey is not empty , then the deviceIdentifier passed in the task is unblocked as follows:

  • The deviceIdentifier should correspond to a specific device and not a group, if so it then runs task on that device and unblocks that specific device , so that it can be used again by other tasks.

Unblocking frozen blocked devices
Automatically unblocking of the devices which have been blocked for more than 4 hours. The default time for unblocking a device is taken as 4 hours for now.

Usecase
This is useful in cases when you want to run multiple tasks on the same device one after the other.

typeSpecificParamCheck
Added the following type specific param check for runningType INSTRUMENTATION:

  • Added check that a task should not set both unblockDevice and blockDevice as true in the same task as this is always true by default and redundant.
  • Added check that when unblockDevice is set to true the value of unblockDeviceSecretKey should not be empty as it is required to unblock a specific device blocked by a specific task.
  • Added check that when unblockDevice is set to true the value of deviceIdentifier passed for blocking should not be a group and instead it should be a specific device serial number.

Linked GitHub issue ID: #673

Pull Request Checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Code compiles correctly with all tests are passed.
  • I've read the contributing guide and followed the recommended practices.
  • Wikis or README have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.

  • Yes
  • No

How you tested it

Tested it on the center side by sending a POST api api/test/task/run with required parameters. It successfully blocks and unblocks the device successfully. This can be validated from the test task id as well. Here are the screenshots of the same.

Blocking:
Screenshot 2025-02-27 at 11 49 46

Unblocking:
Screenshot 2025-02-27 at 11 52 38

Run task on a blocked device again:
Screenshot 2025-02-28 at 14 33 54

Blocking unblocking in the same test task should throw Exception:
Screenshot 2025-02-28 at 13 56 35

Unblocking a device but no/empty secret key passed to unblock the device should throw exception:
Screenshot 2025-02-28 at 13 56 14

Unblocking a device but deviceIdentifier of a group is passed should throw exception:
Screenshot 2025-02-28 at 14 24 36

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Technical design
  • Build related changes
  • Refactoring (no functional changes, no api changes)
  • Code style update (formatting, renaming) or Documentation content changes
  • Other (please describe):

Feature UI screenshots or Technical design diagrams

If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...

Ujjwal Srivastava added 3 commits February 18, 2025 16:58
… methods in DeviceAgentManagementService to handle blocking and unblocking a device and releasing any frozen blocked devices
…ame test task. Added block device by specific device Identifier
…eIdentifier is a group. Also changed the name of output variable unblockDeviceSecretKey to UnblockDeviceSecretKey
@ASPS002
Copy link
Collaborator Author

ASPS002 commented Feb 19, 2025

@microsoft-github-policy-service agree company="Microsoft"

@ASPS002 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="Microsoft"

@ASPS002 ASPS002 self-assigned this Feb 19, 2025
@ASPS002 ASPS002 marked this pull request as ready for review February 21, 2025 05:06
@ASPS002 ASPS002 removed their assignment Feb 24, 2025
@rakirs2
Copy link

rakirs2 commented Feb 24, 2025 via email

@girmaw
Copy link

girmaw commented Feb 24, 2025 via email

@shaleen
Copy link

shaleen commented Feb 24, 2025

Repo owners: Please figure out how to set up notifications properly and stop sending notifications.

@losamig
Copy link

losamig commented Feb 24, 2025 via email

@bpkroth
Copy link

bpkroth commented Feb 24, 2025

image Somehow all/many MS employees were subscribed to "All Activity" for this repo at some point. You can unselect for yourself in the image above, but yes, it'd be nice if folks didn't do this in the first place 🙏 😄

Ujjwal Srivastava and others added 5 commits February 25, 2025 12:21
…de the unblockDeviceSecretKey along with the device serial number to run a task on the blocked device with the specific device serial number.
…e blocked device itself if that task blocks that device earlier.
olivershen-wow
olivershen-wow previously approved these changes Feb 27, 2025
Copy link
Contributor

@olivershen-wow olivershen-wow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the plugin part.

@ASPS002 ASPS002 merged commit cbc34c7 into main Mar 3, 2025
7 checks passed
@ASPS002 ASPS002 deleted the user/ujsrivastava/block_unblock_device_test_spec branch March 3, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants