Skip to content

Live tests for managed identity, username/password, browser credentials#7622

Merged
chlowell merged 11 commits intoAzure:masterfrom
chlowell:identity-live
Nov 6, 2019
Merged

Live tests for managed identity, username/password, browser credentials#7622
chlowell merged 11 commits intoAzure:masterfrom
chlowell:identity-live

Conversation

@chlowell
Copy link
Member

@chlowell chlowell commented Oct 4, 2019

These require specific conditions to run:

  • MSI tests will run whenever appropriate environment variables are set (e.g. in App Service)
  • IMDS tests will run when the tester sets $TEST_IMDS (tester must opt-in because one can discover IMDS support only by trying to use it)
  • managed identity tests, if they run, will also test user-assigned managed identity when an id is provided in $MANAGED_IDENTITY_ID
  • username/password tests run when the tester sets $AZURE_USERNAME, $AZURE_PASSWORD, and $USER_TENANT
  • manual tests (device code, interactive browser auth) only run when 'manual' marker is selected pytest ... -m manual
  • device code prints the code to stdout and so requires pytest ... -s to make that visible

Which is all to say they won't run in CI today. The primary value of this change is that is simplifies running them manually.

@chlowell chlowell added Client This issue points to a problem in the data-plane of the library. Azure.Identity labels Oct 4, 2019
@chlowell chlowell requested a review from daviwil October 4, 2019 20:43
@chlowell chlowell requested a review from schaabs as a code owner October 4, 2019 20:43
@chlowell chlowell self-assigned this Oct 4, 2019
@adxsdk6
Copy link

adxsdk6 commented Oct 4, 2019

Can one of the admins verify this patch?

@chlowell
Copy link
Member Author

chlowell commented Oct 7, 2019

/check-enforcer evaluate

@chlowell chlowell changed the title Live tests for managed identity and username/password Live tests for managed identity, username/password, browser credentials Oct 8, 2019
@chlowell chlowell force-pushed the identity-live branch 2 times, most recently from 1c2e470 to 1a65707 Compare October 22, 2019 15:58
Copy link
Member

@KieranBrantnerMagee KieranBrantnerMagee left a comment

Choose a reason for hiding this comment

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

LGTM, two small comments that might improve clarity.

Choose a reason for hiding this comment

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

"paranoia-for-future-me-being-dumb" comment incoming: Your commit message gives good detail on usage of these flags, but as an outsider coming in, I'm not sure if it's at all discoverable. Is there a readme/other source of knowledge for identity tests? (in a perfect world I'd want to plumb this into proper args and give it details in -h, but I would guess that's hard because identity is just one possible configuration within our generic pytest setup?)

Copy link
Member Author

@chlowell chlowell Nov 4, 2019

Choose a reason for hiding this comment

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

This particular line was an ugly hack to determine whether pytest was launched with '-m manual', so we can use the 'manual' marker to opt in to manual tests. To your broader point, all knowledge outside the code is tribal. I have a tracking issue for documenting the test matrix (#8368) but there's higher priority test work likely to obsolete any document written today, e.g. setting up recording infrastructure (#5980).

Choose a reason for hiding this comment

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

My first thought reading this was that prints is an unused parameter, but realized it was a fixture you wrote to skip this test. That pattern wasn't super intuitive to me; if it's consistent with broader use or pytest practices feel free to ignore this, but a "check and skip" seems like more of a decorator than a fixture?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, that's a good suggestion, I replaced the fixture with a marker.

Copy link
Member

@KieranBrantnerMagee KieranBrantnerMagee left a comment

Choose a reason for hiding this comment

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

LGTM, one comment that may just be paranoia.

# Ignore async tests on unsupported platforms
if sys.version_info < (3, 5):
collect_ignore_glob.append("*_async.py")
collect_ignore_glob = ["*_async.py"]
Copy link
Member

Choose a reason for hiding this comment

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

should we have a collect_ignore_glob = [] above given that we nixed the imds initialization?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, pytest doesn't require a value for collect_ignore_glob.

@chlowell chlowell merged commit 009be3f into Azure:master Nov 6, 2019
@chlowell chlowell deleted the identity-live branch November 6, 2019 23:17
xiangyan99 added a commit that referenced this pull request Nov 8, 2019
* Updated minor version for released packages in hotfix branch

* Refactor ClientCertificateCredential construction (#8315)

* Update MSAL dependency (#8359)

* Fix InteractiveBrowserCredential caching (#8352)

* Disable depends test (#8440)

* [EventHubs] Final README update (#8430)

* [EventHubs] Final docs update (#8428)

* Readme final update

* Update links

* update async sample in readme

* Simply samples in readme and make samples can run (#8432)

* Tiny readme fix

* Update checkpointstore README

* Update checkpointstore README

* Fix a README error

* App Configuration 2019-10-01  (#8394)

* update sdk\keyvault\azure-keyvault-secrets\README.md (#8396)

* bump warden version (#8460)

* Add passing kwargs and HttpLoggingPolicy plugged (#8053)

* Live tests for managed identity, username/password, browser credentials (#7622)

* policy v2019_09_01 (#8397)

* Fix media streaming bug (#8385)

* initial commit to fix media streaming bug

- Removed media streaming related checks in synchronized_request that was causing issues with DBAs with "media" in the name
- Refactored pipeline_client.run into a _PipelineRun method for testing purposes

* bumped version

* removed references to 'Media'

* bumped version in readme

* removed unused import for pylint

* undid test config changes

* updated HISTORY with breaking changes

* modified changelog

* Work around sphinx markdown heading link bug (#8255)

* move smoke tests

update smoke-test.yml

move smoketests to common folder

* consistent smoke test requirements

* remove smoke test invocations that don't exist

* use original interface

* remove phantom smoke tests

* New CI to check autorest when changes are made in azure-core (#8509)

* ADLS Gen2 API Implementation (#8473)

* ADLS Gen2 API Implementation (#8473)

* network parameter change (#8529)

* [AutoPR] appconfiguration/resource-manager (#8528)

* New azure-mgmt-web + fixed mixin script (#8334)

* list skus test

* adding api_version in mixin instance

* regenerated new package

* regeneated tests

* history and version

* [AutoPR] cognitiveservices/data-plane/LUIS/Authoring (#7816)

* [AutoPR cognitiveservices/data-plane/LUIS/Authoring] Add v3.0 swagger (#7815)

* Generated from 7a554c128d6eba201c576885c8c2ea78f5267481

Add v3.0 swagger

* Generated from d3a4f2d1674a63bc9a4a57015f956833c7d40f7b

Update LUIS-Authoring.json

fix semantic bugs

* regenerated luis

* updated history and version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Identity Client This issue points to a problem in the data-plane of the library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments