-
Notifications
You must be signed in to change notification settings - Fork 3.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
Update the data in the test cases #18496
Merged
wyunchi-ms
merged 2 commits into
Azure:wyunchi/predictor-ci
from
kceiw:mahuang/FixUnitTests
Jun 16, 2022
Merged
Update the data in the test cases #18496
wyunchi-ms
merged 2 commits into
Azure:wyunchi/predictor-ci
from
kceiw:mahuang/FixUnitTests
Jun 16, 2022
Conversation
This file contains 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
- Parsing the command parameter requires the module to be loaded. On the machine (e.g. build machine) where the Az modules are not installed, the parsing doesn't return the parameters names as expected. Some test cases thus fail. The fix is to remove Az cmdlets from the test cases. Instead, we use the cmdlet from the built-in modules in the test cases.
- We used to zip the whole model and read from it. Since we don't need to use Az cmdlet in the test cases, we don't really need to zip the model. So we use the json file with crafted built-in PowerShell cmdlet as the data used in the test cases. With that, it's also clear to show the changes to the test cases and the data.
jjaguirre394
approved these changes
Jun 13, 2022
mirdaki
approved these changes
Jun 14, 2022
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.
LGTM
wyunchi-ms
approved these changes
Jun 16, 2022
wyunchi-ms
pushed a commit
that referenced
this pull request
Jun 22, 2022
* Fix the unit tests. - Parsing the command parameter requires the module to be loaded. On the machine (e.g. build machine) where the Az modules are not installed, the parsing doesn't return the parameters names as expected. Some test cases thus fail. The fix is to remove Az cmdlets from the test cases. Instead, we use the cmdlet from the built-in modules in the test cases. * Replace the way of getting the data. - We used to zip the whole model and read from it. Since we don't need to use Az cmdlet in the test cases, we don't really need to zip the model. So we use the json file with crafted built-in PowerShell cmdlet as the data used in the test cases. With that, it's also clear to show the changes to the test cases and the data. Add Dotnet Core 6 in pipeline. Add logic for global.json Add logic for global.json
wyunchi-ms
added a commit
that referenced
this pull request
Jun 23, 2022
* Trigger Az.Predictor CI * Fix the issue when running the unit tests (#18300) * Fix the issue in unit tests. - In the module we create a minimum runspace for PowerShell, and use it to parse the command line. The mini runspace contains the built-in core modules for PowerShell. We don't need them when we package and publish our module because the runtime will have them. That'll reduce the module size. So in the module project we exclude `contentfiles` when we referece Microsoft.PowerShell.SDK. - The issue in the unit tests is that it doesn't find the built-in core module when we create the runspace. So we have a reference to Microsoft.PowerShell.SDK in the test project to include `contentfiles` to provide the built-in core modules. The unit tests can run successfully. * Test * Update the data in the test cases (#18496) * Fix the unit tests. - Parsing the command parameter requires the module to be loaded. On the machine (e.g. build machine) where the Az modules are not installed, the parsing doesn't return the parameters names as expected. Some test cases thus fail. The fix is to remove Az cmdlets from the test cases. Instead, we use the cmdlet from the built-in modules in the test cases. * Replace the way of getting the data. - We used to zip the whole model and read from it. Since we don't need to use Az cmdlet in the test cases, we don't really need to zip the model. So we use the json file with crafted built-in PowerShell cmdlet as the data used in the test cases. With that, it's also clear to show the changes to the test cases and the data. Add Dotnet Core 6 in pipeline. Add logic for global.json Add logic for global.json * Move AzPredictor from msbuild to task * Revert empty lines Co-authored-by: kceiw <mahuang@microsoft.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
We use the PowerShell api to parse the cmdlet from the user input. It requires the corresponding module to be installed so that it can import it and use it to extract the parameter names from the user input. But that module (e.g. Az modules) are not installed in build machines. The test cases that need to extract the parameter names will fail. The solution here is to not to use Az cmdlets as the input for the test cases. We use the cmdlets from the built-in modules, which are copied to the test directory. Thus we can maintain minimal set up for the test machines and still be able to test the functionality in the product code.
Checklist
CONTRIBUTING.md
ChangeLog.md
file(s) has been updated:ChangeLog.md
file can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
## Upcoming Release
header -- no new version header should be added