Skip to content
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

Improve line and branch coverage for Http policy related files. #2479

Open
ahsonkhan opened this issue Jan 14, 2023 · 1 comment
Open

Improve line and branch coverage for Http policy related files. #2479

ahsonkhan opened this issue Jan 14, 2023 · 1 comment

Comments

@ahsonkhan
Copy link
Member

Our line coverage bar for the repo is is 90% and branch coverage is 70%.

Though HTTP pipeline and policies are challenging to add unit tests for (and in some cases require live tests that run nightly to improve coverage), these files are significantly below our current bar:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2104943&view=codecoverage-tab
image

For example, the az_http_pipeline_policy_credential() function isn't covered by any test.

AZ_NODISCARD az_result az_http_pipeline_policy_credential(
_az_http_policy* ref_policies,
void* ref_options,
az_http_request* ref_request,
az_http_response* ref_response)
{
_az_credential* const credential = (_az_credential*)ref_options;
_az_http_policy_process_fn const policy_credential_apply
= credential == NULL ? NULL : credential->_internal.apply_credential_policy;
if (credential == AZ_CREDENTIAL_ANONYMOUS || policy_credential_apply == NULL)
{
return _az_http_pipeline_nextpolicy(ref_policies, ref_request, ref_response);
}
return policy_credential_apply(ref_policies, credential, ref_request, ref_response);
}

This becomes necessary to support services that use the HTTP protocol such as storage, which we currently have as part of a feature branch.

{
._internal = {
.process = az_http_pipeline_policy_retry,
.options = &out_client->_internal.options.retry_options,
},
},
{
._internal = {
.process = az_http_pipeline_policy_credential,
.options = cred,
},

Brought up in #2443 (comment)

cc @antkmsft

@CIPop
Copy link
Member

CIPop commented Jun 28, 2023

Hidden by MicrosoftPremier/VstsExtensions#219

Blocked #2591 : we're working around by temporarily lowering the thresholds in feature/v2 until each file is at required levels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants