-
Notifications
You must be signed in to change notification settings - Fork 5.1k
test-resources.json and test changes #23117
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
Merged
Mohit-Chakraborty
merged 20 commits into
Azure:main
from
ormichae:ormichae/updateTestEnvVariables
Aug 18, 2021
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
29d6f7d
test-resources.json and test changes
ormichae ce3403c
exported api
ormichae bb518e9
rounded float
ormichae dfe5f35
ignore body
ormichae 1a4095f
added timeouts in test
ormichae b423f72
consoladated tests
ormichae 8fc7ea4
changes region for resources
ormichae ba90642
moved resources to east us
ormichae 53f2deb
added delay between update policy and get
ormichae d52d83c
merged all multislot tests
ormichae bc36dba
create resources in east us 2
ormichae b062b2e
test-resources.json
ormichae bd8c054
changed test to address float rounding
ormichae 98cd5f1
moved test tesources to east us
ormichae b865344
movel resource to canary
ormichae 763399e
changed resource location to centralus
ormichae b894b18
added remove test resources post script
ormichae 03ce9c1
added line to eof
ormichae da1a35a
pr comments
ormichae 4b47a69
changed resource deployment to eastus2euap
ormichae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
sdk/personalizer/Azure.AI.Personalizer/src/Generated/PersonalizerClientOptions.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,79 +14,71 @@ public ConfigurationsTests(bool isAsync): base(isAsync) | |
| } | ||
|
|
||
| [Test] | ||
| public async Task GetServiceConfiguration() | ||
| public async Task ConfigurationTests() | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| PersonalizerServiceProperties defaultConfig = await client.GetPersonalizerPropertiesAsync(); | ||
| Assert.AreEqual(TimeSpan.FromMinutes(1), defaultConfig.RewardWaitTime); | ||
| Assert.AreEqual(TimeSpan.FromHours(1), defaultConfig.ModelExportFrequency); | ||
| Assert.AreEqual(1, defaultConfig.DefaultReward); | ||
| Assert.AreEqual(0.2, defaultConfig.ExplorationPercentage, 0.00000001); | ||
| Assert.AreEqual(0, defaultConfig.LogRetentionDays); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task ApplyFromEvaluation() | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| PersonalizerPolicyReferenceOptions policyReferenceContract = new PersonalizerPolicyReferenceOptions("628a6299-ce45-4a9d-98a6-017c2c9ff008", "Inter-len1"); | ||
| await client.ApplyPersonalizerEvaluationAsync(policyReferenceContract); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task UpdateServiceConfiguration() | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| TimeSpan newExperimentalUnitDuration = TimeSpan.FromMinutes(1); | ||
| TimeSpan modelExportFrequency = TimeSpan.FromHours(1); | ||
| TimeSpan newExperimentalUnitDuration = TimeSpan.FromSeconds(7); | ||
| TimeSpan modelExportFrequency = TimeSpan.FromMinutes(3); | ||
| double newDefaultReward = 1.0; | ||
| string newRewardFuntion = "average"; | ||
| double newExplorationPercentage = 0.2f; | ||
| var config = new PersonalizerServiceProperties ( | ||
| float newExplorationPercentage = 0.2f; | ||
| var properties = new PersonalizerServiceProperties( | ||
| rewardAggregation: newRewardFuntion, | ||
| modelExportFrequency: modelExportFrequency, | ||
| defaultReward: (float)newDefaultReward, | ||
| rewardWaitTime: newExperimentalUnitDuration, | ||
| explorationPercentage: (float)newExplorationPercentage, | ||
| explorationPercentage: newExplorationPercentage, | ||
| logRetentionDays: int.MaxValue | ||
| ); | ||
| PersonalizerServiceProperties result = await client.UpdatePersonalizerConfigurationAsync(config); | ||
| Assert.AreEqual(config.DefaultReward, result.DefaultReward); | ||
| Assert.True(Math.Abs(config.ExplorationPercentage - result.ExplorationPercentage) < 1e-3); | ||
| Assert.AreEqual(config.ModelExportFrequency, result.ModelExportFrequency); | ||
| Assert.AreEqual(config.RewardAggregation, result.RewardAggregation); | ||
| Assert.AreEqual(config.RewardWaitTime, result.RewardWaitTime); | ||
| PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true); | ||
| await UpdateProperties(client, properties); | ||
| await GetProperties(client, properties); | ||
| await UpdateAndGetPolicy(client); | ||
| await ResetPolicy(client); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task GetPolicy() | ||
| private async Task GetProperties(PersonalizerAdministrationClient client, PersonalizerServiceProperties properties) | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| PersonalizerPolicy policy = await client.GetPersonalizerPolicyAsync(); | ||
| Assert.AreEqual("app1", policy.Name); | ||
| Assert.AreEqual("--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2", | ||
| policy.Arguments); | ||
| PersonalizerServiceProperties result = await client.GetPersonalizerPropertiesAsync(); | ||
| Assert.AreEqual(properties.DefaultReward, result.DefaultReward); | ||
| Assert.True(Math.Abs(properties.ExplorationPercentage - result.ExplorationPercentage) < 1e-3); | ||
| Assert.AreEqual(properties.ModelExportFrequency, result.ModelExportFrequency); | ||
| Assert.AreEqual(properties.RewardAggregation, result.RewardAggregation); | ||
| Assert.AreEqual(properties.RewardWaitTime, result.RewardWaitTime); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task UpdatePolicy() | ||
| private async Task UpdateProperties(PersonalizerAdministrationClient client, PersonalizerServiceProperties properties) | ||
| { | ||
| PersonalizerServiceProperties result = await client.UpdatePersonalizerPropertiesAsync(properties); | ||
| Assert.AreEqual(properties.DefaultReward, result.DefaultReward); | ||
| Assert.True(Math.Abs(properties.ExplorationPercentage - result.ExplorationPercentage) < 1e-3); | ||
| Assert.AreEqual(properties.ModelExportFrequency, result.ModelExportFrequency); | ||
| Assert.AreEqual(properties.RewardAggregation, result.RewardAggregation); | ||
| Assert.AreEqual(properties.RewardWaitTime, result.RewardWaitTime); | ||
| if (Environment.GetEnvironmentVariable("AZURE_TEST_MODE") == "Record") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a Mode property on the base type |
||
| { | ||
| await Task.Delay(60000); | ||
| } | ||
| } | ||
|
|
||
| private async Task UpdateAndGetPolicy(PersonalizerAdministrationClient client) | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| var policy = new PersonalizerPolicy( | ||
| var newPolicy = new PersonalizerPolicy( | ||
| name: "app1", | ||
| arguments: "--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2" | ||
| ); | ||
| PersonalizerPolicy updatedPolicy = await client.UpdatePersonalizerPolicyAsync(policy); | ||
| PersonalizerPolicy updatedPolicy = await client.UpdatePersonalizerPolicyAsync(newPolicy); | ||
| Assert.NotNull(updatedPolicy); | ||
| Assert.AreEqual(policy.Arguments, updatedPolicy.Arguments); | ||
| Assert.AreEqual(newPolicy.Arguments, updatedPolicy.Arguments); | ||
| await Task.Delay(30000); | ||
| PersonalizerPolicy policy = await client.GetPersonalizerPolicyAsync(); | ||
| // Only checking the first 190 chars because the epsilon has a float rounding addition when applied | ||
| Assert.AreEqual(newPolicy.Arguments, policy.Arguments.Substring(0,190)); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task ResetPolicy() | ||
| private async Task ResetPolicy(PersonalizerAdministrationClient client) | ||
| { | ||
| PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient(); | ||
| PersonalizerPolicy policy = await client.ResetPersonalizerPolicyAsync(); | ||
| Assert.AreEqual("--cb_explore_adf --quadratic GT --quadratic MR --quadratic GR --quadratic ME --quadratic OT --quadratic OE --quadratic OR --quadratic MS --quadratic GX --ignore A --cb_type ips --epsilon 0.2", | ||
| Assert.AreEqual("--cb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::", | ||
| policy.Arguments); | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal. It makes the playback test take a minute.