Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
177 stars 126 forks source link

Fix KeyVaultChallengeBasedAuthenticationPolicy test MultipleTimes since the bearer token policy now invalidates the token cache on receiving a 401. #6191

Closed ahsonkhan closed 3 weeks ago

ahsonkhan commented 3 weeks ago

With https://github.com/Azure/azure-sdk-for-cpp/pull/6151 and subsequent overflow fix https://github.com/Azure/azure-sdk-for-cpp/pull/6190, this specific test behavior needs to be updated to match expectations.

We no longer return an older cached token, since those are rightly invalidated whenever a challenge response is received.

Fixes the test failure from https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4308371&view=logs&j=d321cacd-258d-5801-407f-101c556a68a1&t=3eed5caa-5462-5e1e-56c8-8288eee731c0&l=36941

2024-11-07T03:09:27.9515644Z 158: /mnt/vss/_work/1/s/sdk/keyvault/azure-security-keyvault-secrets/test/ut/challenge_based_authentication_policy_test.cpp:98: Failure
2024-11-07T03:09:27.9516645Z 158: Expected: (m_currentResponse) < (m_responses.size()), actual: 4 vs 4
2024-11-07T03:09:27.9517355Z 158: unknown file: Failure
2024-11-07T03:09:27.9518481Z 158: C++ exception with description "GetToken(): vector::_M_range_check: __n (which is 4) >= this->size() (which is 4)" thrown in the test body.
2024-11-07T03:09:27.9522027Z 158: [  FAILED  ] KeyVaultChallengeBasedAuthenticationPolicy.MultipleTimes (5 ms)
azure-sdk commented 3 weeks ago

API change check

API changes are not detected in this pull request.

ahsonkhan commented 3 weeks ago

/azp run cpp - keyvault

azure-pipelines[bot] commented 3 weeks ago
Azure Pipelines successfully started running 1 pipeline(s).
ahsonkhan commented 3 weeks ago

/azp run cpp - storage

azure-pipelines[bot] commented 3 weeks ago
Azure Pipelines successfully started running 1 pipeline(s).