Skip to content

Conversation

@pritishpai
Copy link
Contributor

Changes

Adds a property id which is needed to use the created service principal in tests

Linked issues

Resolves the no-cheat in
databrickslabs/ucx#4360

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

✅ 40/40 passed, 6 skipped, 7m20s total

Running from acceptance #214

Copy link
Contributor

@asnare asnare left a comment

Choose a reason for hiding this comment

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

Is there a local test or something that's covering the fixture we've updated?

@asnare asnare self-requested a review August 7, 2025 07:46
@pritishpai
Copy link
Contributor Author

Is there a local test or something that's covering the fixture we've updated?

@asnare I have added a unit and an integration test.

Copy link
Contributor

@asnare asnare left a comment

Choose a reason for hiding this comment

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

LGTM

@asnare asnare added the bug Something isn't working label Aug 7, 2025
@pritishpai pritishpai merged commit 2c703d2 into main Aug 7, 2025
8 checks passed
@pritishpai pritishpai deleted the feat/add_id_runas branch August 7, 2025 16:52
gueniai added a commit that referenced this pull request Aug 7, 2025
* Added property `id` to get service principal id ([#170](#170)). The service principal functionality has been enhanced with the introduction of a new `id` property, which returns the service principal ID as a string, simplifying its usage in tests. The `create` method has been updated to utilize this `id` property, ensuring consistency throughout the code. Additionally, the `id` property is now directly used when creating secrets, updating group memberships, and updating workspace assignments, with the exception of the `workspace_assignment.update` method. The logging of account links has also been updated to use the `id` property. Furthermore, test cases have been updated to include service principals in group members, and a new function `make_run_as` has been introduced to create service principals for testing purposes, along with a new test case `test_make_run_as_no_args` to verify its functionality, addressing issues related to no-cheat in linked pull requests and improving overall testing capabilities.
* Updated `call_fixture()` to work with pytest 8.4 ([#166](#166)). The `call_fixture` function has been enhanced to support pytest version 8.4 and later, while maintaining backward compatibility with older versions. To address the deprecation of direct access to pytest fixtures since version 4.x, the function now dynamically checks the pytest version and utilizes the corresponding mechanism to unwrap fixtures. For pytest 8.4 and later, it leverages the `_get_wrapped_function` attribute, whereas for older versions, it relies on the `__pytest_wrapped__` attribute. Additionally, the function now includes input validation, raising a `ValueError` if the provided function is not a valid pytest fixture, ensuring more robust error handling. This update provides a temporary solution, with plans for future refinement to potentially utilize `pytest.FixtureRequest` and `request.getfixturevalue()` for accessing fixtures in a more supported and sustainable manner.
@gueniai gueniai mentioned this pull request Aug 7, 2025
gueniai added a commit that referenced this pull request Aug 7, 2025
# Release notes:
* Added property `id` to get service principal id
([#170](#170)). The
service principal functionality has been enhanced with the introduction
of a new `id` property, which returns the service principal ID as a
string, simplifying its usage in tests. The `create` method has been
updated to utilize this `id` property, ensuring consistency throughout
the code. Additionally, the `id` property is now directly used when
creating secrets, updating group memberships, and updating workspace
assignments, with the exception of the `workspace_assignment.update`
method. The logging of account links has also been updated to use the
`id` property. Furthermore, test cases have been updated to include
service principals in group members, and a new function `make_run_as`
has been introduced to create service principals for testing purposes,
along with a new test case `test_make_run_as_no_args` to verify its
functionality, addressing issues related to no-cheat in linked pull
requests and improving overall testing capabilities.
* Updated `call_fixture()` to work with pytest 8.4
([#166](#166)). The
`call_fixture` function has been enhanced to support pytest version 8.4
and later, while maintaining backward compatibility with older versions.
To address the deprecation of direct access to pytest fixtures since
version 4.x, the function now dynamically checks the pytest version and
utilizes the corresponding mechanism to unwrap fixtures. For pytest 8.4
and later, it leverages the `_get_wrapped_function` attribute, whereas
for older versions, it relies on the `__pytest_wrapped__` attribute.
Additionally, the function now includes input validation, raising a
`ValueError` if the provided function is not a valid pytest fixture,
ensuring more robust error handling. This update provides a temporary
solution, with plans for future refinement to potentially utilize
`pytest.FixtureRequest` and `request.getfixturevalue()` for accessing
fixtures in a more supported and sustainable manner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants