azure-sdk-for-js icon indicating copy to clipboard operation
azure-sdk-for-js copied to clipboard

[identity][test] assertion errors are swallowed

Open jeremymeng opened this issue 1 year ago • 1 comments

Some identity tests catch then log the error, when assertion failed, the error are swallowed and not reported as failures

https://github.com/Azure/azure-sdk-for-js/blob/96faafab3c6e3351fa7f33e809520231998f6c77/sdk/identity/identity/test/internal/node/workloadIdentityCredential.spec.ts#L96

and

https://github.com/Azure/azure-sdk-for-js/blob/96faafab3c6e3351fa7f33e809520231998f6c77/sdk/identity/identity/test/internal/node/workloadIdentityCredential.spec.ts#L121

[node-tests]   WorkloadIdentityCredential
[node-tests]     ✔ authenticates with WorkloadIdentity Credential
[node-tests]     ✔ authenticates with ManagedIdentity Credential
[node-tests] AssertionError: expected 'EnvironmentCredential' to equal 'WorkloadIdentityCredential'
[node-tests]     at Context.<anonymous> (/mnt/vss/_work/1/s/sdk/identity/identity/test/internal/node/workloadIdentityCredential.spec.ts:85:14) {
[node-tests]   showDiff: true,
[node-tests]   actual: 'EnvironmentCredential',
[node-tests]   expected: 'WorkloadIdentityCredential',
[node-tests]   operator: 'strictEqual'
[node-tests] }
[node-tests]     ✔ authenticates with DefaultAzure Credential
[node-tests] AssertionError: expected 'EnvironmentCredential' to equal 'WorkloadIdentityCredential'
[node-tests]     at Context.<anonymous> (/mnt/vss/_work/1/s/sdk/identity/identity/test/internal/node/workloadIdentityCredential.spec.ts:110:14) {
[node-tests]   showDiff: true,
[node-tests]   actual: 'EnvironmentCredential',
[node-tests]   expected: 'WorkloadIdentityCredential',
[node-tests]   operator: 'strictEqual'
[node-tests] }

Other places where it also swallow errors but tests didn't fail

https://github.com/Azure/azure-sdk-for-js/blob/c7301ab78063fa366ec6d08254e5c02806e8be30/sdk/identity/identity/test/public/node/workloadIdentityCredential.spec.ts#L86

https://github.com/Azure/azure-sdk-for-js/blob/c7301ab78063fa366ec6d08254e5c02806e8be30/sdk/identity/identity/test/public/node/workloadIdentityCredential.spec.ts#L104

jeremymeng avatar Jan 29 '24 23:01 jeremymeng

@KarishmaGhiya not sure why we swallow errors here, mind taking a look? I'll take #28413

maorleger avatar Jan 30 '24 15:01 maorleger