-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[MetricsAdvisor] Add tests for extra Get call in the Create methods #18589
Comments
Hi @kinelski. There hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by removing the |
Hi @kinelski. There was a mistake and this issue was unintentionally flagged as a stale pull request. The label has been removed and the issue will remain active; no action is needed on your part. Apologies for the inconvenience. |
Hi, @kinelski. I am interested in this issue. I see this issue is started from your comment in PR #18491. And #18480 does not avoid using extra
I am planning to create a mock of public class MockMetricsAdvisorAdministrationClient : MetricsAdvisorAdministrationClient
{
public virtual async Task<Response<AnomalyAlertConfiguration>> GetAlertConfiguration(string alertConfigurationId, CancellationToken cancellationToken = default)
{
// Throw exception when CreateAlertConfiguration call GetAlertConfiguration inside to test.
throw;
}
// Other Get method mocks...
} Where should I put this class in project Azure.AI.MetricsAdvisor.Tests? LiveTests create Line 734 in 4283d09
So, should I create new public class MockMetricsAdvisorLiveTestBase : MetricsAdvisorLiveTestBase
{
public override MetricsAdvisorAdministrationClient GetMetricsAdvisorAdministrationClient(bool useTokenCredential = false)
{
return new MockMetricsAdvisorAdministrationClient();
}
} Or, just create a method like in Lines 165 to 171 in 4283d09
private MetricsAdvisorAdministrationClient GetMetricsAdvisorAdministrationClient()
{
return new MockMetricsAdvisorAdministrationClient();
} |
We need to test the behavior when the first call (create) succeeds and the last call (get) fails. We can probably do it by mocking our client.
Methods to test:
Note: maybe only applicable to
CreateDataFeed
depending on the outcome of #18480.The text was updated successfully, but these errors were encountered: