[Key Vault] Fixing min-max tests by moving test utilities to test/public#19959
[Key Vault] Fixing min-max tests by moving test utilities to test/public#19959sadasant merged 28 commits intoAzure:mainfrom
Conversation
KarishmaGhiya
left a comment
There was a problem hiding this comment.
sorry i didn't notice the ci failing. had approved since the min-max tests pass
|
/azp run js - keyvault-certificates - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
maorleger
left a comment
There was a problem hiding this comment.
Thanks so much for taking this effort! I left a few comments but I have some open-ended questions / concerns if you don't mind
- Requiring utils to be in public folder feels implicit and brittle since nothing lets me know if I don't follow this convention. I can definitely imagine a situation where I break this in the future. Are there any options to encode this into a linter or CI validation or something? @KarishmaGhiya
- It sounds like the outcome of not doing this is that test coverage gets missed in min/max testing is that right? If so, let's run a live test against this PR for each of the KV libraries and make sure that our min/max builds run significantly more tests now than in the latest main scheduled builds - if we didn't improve maybe we don't need to bother?
| /** | ||
| * The latest supported KeyVault service API version | ||
| */ | ||
| export const LATEST_API_VERSION = "7.3-preview"; |
There was a problem hiding this comment.
Can we infer this from https://github.com/Azure/azure-sdk-for-js/pull/19959/files#diff-8182aee8eae78191aaa9301924729aafe2786e1f58fd5bd5bc31af8c28405d23R43 instead of redefining it? I just worry about having yet another place to change you know?
| import { BeginRestoreKeyBackupOptions } from "../../public/utils/lro/restore/operation"; | ||
| import TestClient from "../../public/utils/testClient"; | ||
|
|
||
| export default class InternalTestClient extends TestClient { |
There was a problem hiding this comment.
Where is this used? If only like a one or two places can we just remove this class and inline this logic in the test or make a helper function in the test file?
There was a problem hiding this comment.
Ok I like the idea of inlining this!
There was a problem hiding this comment.
We talked over teams. Here’s what I’ll do:
This class is intended to help us do some common functionality on many tests. This specific extension is only used in one test, so we can grab the internals of this extra function and move it to the test directly, then remove this class.
I’ll do that!
| export async function authenticate( | ||
| that: Context, | ||
| version: string, | ||
| testClientMaker?: (client: KeyClient) => TestClientInterface |
There was a problem hiding this comment.
This feels a little odd to me - what is this used for? Sorry, I forgot 😄
There was a problem hiding this comment.
it’s to allow for the replacement of the TestClient with the InternalTestClient. The TestClient at the moment has some private references.
| purgeKey: (keyName: string) => Promise<void>; | ||
| flushKey: (keyName: string) => Promise<void>; | ||
| } | ||
| export default class TestClient implements TestClientInterface { |
There was a problem hiding this comment.
I have a proposal! instead of formatName let's just use recorder.getUniqueName. And then let's just get rid of calls to flushKey and purgeKey - I've been doing that to make our tests faster since the KV gets created and deleted anyway. Then we won't need the testClient at all. What do you think?
There was a problem hiding this comment.
I love that idea! Thank you 🙏 I’ll take it
There was a problem hiding this comment.
Wait, the main point of this test is to restore a key backup, so the unique name won’t help 🤔 I do the purge to then recover the backup. Let’s sync over teams!
| /** | ||
| * The latest supported KeyVault service API version | ||
| */ | ||
| export const LATEST_API_VERSION = "7.3-preview"; |
There was a problem hiding this comment.
We can infer this from https://github.com/Azure/azure-sdk-for-js/pull/19959/files#diff-c3564ec34ef1be7b6ff757d6352c4dc035b76e9fea338b9dad4298414d2a8b03L27 as well - sorry for repeating myself I just wanted to make sure it doesn't get missed
|
@maorleger the min-max tests at the moment only includes the public tests it can run (meaning, that don’t have any internal reference). This PR does increase the number of min-max tests that the Key Vault projects run. The min-max test tooling is rather simple, which should help with maintenance, but I agree that it would be interesting to do a re-engeneering of it, to behave more like our samples tooling. |
|
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
maorleger
left a comment
There was a problem hiding this comment.
🚀 thank you for taking this on!
| import { testPollerProperties } from "./recorderUtils"; | ||
| import { KeyClient } from "../../../src"; | ||
|
|
||
| export interface TestClientInterface { |
There was a problem hiding this comment.
Nit: I think this interface is no longer necessary
|
/azp run js - keyvault-keys - tests |
|
/azp run js - keyvault-certificates - tests |
|
/azp run js - keyvault-keys - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
CI Passed! I’ll merge this. |
add x-ms-identifiers for healthbot (Azure#19959)
This PR focuses on moving the test utilities on the Key Vault packages from
test/utilstotest/public/utils, with the caveat that any references to non-public API would need to either be copied totest/public/somewhere, or moved totest/internal.Fixes #14955