Skip to content

Adding ActivityLogAlerts and ActionGroups API calls, PATCH operations, and the corresponding unit tests#3520

Merged
shahabhijeet merged 9 commits intoAzure:psSdkJson6from
AuxMon:psSdkJson6
Aug 23, 2017
Merged

Adding ActivityLogAlerts and ActionGroups API calls, PATCH operations, and the corresponding unit tests#3520
shahabhijeet merged 9 commits intoAzure:psSdkJson6from
AuxMon:psSdkJson6

Conversation

@gucalder
Copy link
Copy Markdown
Contributor

Adding ActivityLogAlerts and ActionGroups API calls, PATCH operations, and the corresponding unit tests

Description

Adding ActivityLogAlerts and ActionGroups API calls.
Adding PATCH operations
Adding unit tests for the patch and the new API calls.

This is a retry of the closed PR #3514 which included changes from vs17dev, which is not used any longer.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.

@shahabhijeet
Copy link
Copy Markdown
Contributor

@azuresdkci test this please

@shahabhijeet
Copy link
Copy Markdown
Contributor

@gucalder can you add link to the swagger PR

Copy link
Copy Markdown
Contributor

@shahabhijeet shahabhijeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder we need basic scenario tests that will test your service.
This is a requirement and we have asked in the past to add these tests.
Please add recorded tests.
Please use latest Resource Manager nuget to record your tests

@gucalder
Copy link
Copy Markdown
Contributor Author

This is the Swagger PR: Azure/azure-rest-api-specs#1481

… into psSdkJson6

# Conflicts:
#	src/SDKs/Monitor/Management.Monitor/generate.cmd
<!-- PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.0.0" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.8" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="1.7.2" / -->
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder all SDK tests have dependency on newtonsoft.json via clientruntime. Why are you introducing a downgraded version for your tests? What is the reason for doing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That downgraded version comes from AzSdk.reference.props, the item group for net452. It uses 9.0.1 for netstandard1.4. My tests are targeting net452.
Without the explicit reference in the test project all my tests fail in VS with an error that says: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0.... I think this is so since the clientruntime depends on 6.0.8 for net452 (and on 9.0.1 for netstandard1.4.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder any reason you don't have tests that supports .NETStandard1.4

</ItemGroup>

<ItemGroup>
<Reference Include="System.Net.Http" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly why do you need a separate System.NET.Http dependency as it is already part of your management client.
Any reason for adding this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get several compilation errors for net452 if I do not include it.

<ItemGroup>
<!-- PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.0.0" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.8" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="1.7.2" / -->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder remove all commented code.
Also use latest Resource manager 1.6.0 at least, you are still targeting 1.1.0 resource manager
Record all your tests using latest resource manager.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That version of resource manager comes from AzSdk.test.reference.props, which is including it unconditionally. I have no explicit reference to this package/dll.
I am going to need guidance here:
I can add an explicit reference to the package called:

That does not exclude the old reference to 1.1.0-preview. The build contains two dlls:
Microsoft.Azure.Management.ResourceManager.dll
Microsoft.Azure.ResourceManager.dll

Internally, the dlls are similar, but the namespaces and files are different.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder if you see the difference between those two nugets, you will see the namespace is different.
So all I was trying to say is to use the correct namespace and types from the 1.6.0 version

@shahabhijeet
Copy link
Copy Markdown
Contributor

@azuresdkci test this please

<ItemGroup>
<!-- PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.0.0" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.8" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="1.7.2" / -->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder if you see the difference between those two nugets, you will see the namespace is different.
So all I was trying to say is to use the correct namespace and types from the 1.6.0 version

<!-- PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.0.0" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.8" / >
<PackageReference Update="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="1.7.2" / -->
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder any reason you don't have tests that supports .NETStandard1.4

…e Resource Manager dll. Enabling tests for netcoreapp1.1
@gucalder
Copy link
Copy Markdown
Contributor Author

Making sure I am referencing and using Resource Manager 1.6.0.
Enabling tests for netcoreapp1.1 (TestFramework is incompatible with .Net Standard 1.4)

@gucalder
Copy link
Copy Markdown
Contributor Author

Netcoreapp1.1 tests failed because the scenario tests cannot find the SessionRecords files.
Locally, the tests cannot be discovered.
So I removed the netcoreapp1.1 target from the test project. I need more time to figure out what is happening there, but I am running out of time with this PR.

set specFile1="%2"
)

if "%3" == "" (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder you do not need all this code. Any reason you are updating this file.
Simply executing this file will create a _meta file that is what the new way to generate the code.
All this change has already been done for you, you only need to execute generate.cmd the way it is.
Please revert this change.
Once you execute generate.cmd, it will create a .txt file under _metadata directory like below
https://github.com/Azure/azure-sdk-for-net/tree/psSdkJson6/src/SDKs/_metadata

<VersionPrefix>1.0.0-preview</VersionPrefix>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net452</TargetFrameworks>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gucalder any reasons you are doing this.
If you are not able to discover tests that is because of VS 15.3 build.
I had sent an email about installing 15.2 and provided link to install 15.2.
Once you install 15.2 you should be good. Please revert all these changes in your test project.
These changes makes it difficult to make sure all SDKs are created and tested consistently with respect to target framework and updating common references.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My version is 15.1 at the moment. I'll try with 15.2.
The tests are discovered and run fine for .net452. That's how I re-recorded them.
It is only netcoreapp1.1 that does not detect any tests locally. However, in your side, during build, the system apparently discovers them and tries to run the tests for netcoreapp1.1 but fails to find the dll, it looks in a folder where, I assume, the dll is not installed.

@shahabhijeet
Copy link
Copy Markdown
Contributor

@azuresdkci test this please

@shahabhijeet shahabhijeet merged commit 0f85678 into Azure:psSdkJson6 Aug 23, 2017
JasonYang-MSFT pushed a commit to JasonYang-MSFT/azure-sdk-for-net that referenced this pull request Dec 8, 2017
…, and the corresponding unit tests (Azure#3520)

* Adding ActivityLogAlerts and ActionGroups API calls, PATH operations, and the corresponding unit tests

* Generating code from the 'current' branch of the Swagger specs repo

* Adding scenario tests

* Improving scenario tests and re-recording them

* Making sure the scenario tests point to the more recent version of the Resource Manager dll. Enabling tests for netcoreapp1.1

* Reverting netcoreapp1.1 test target since it fails to find the records.

* Returning generate.md to its Azure\psSdkJson6 state

* Re-enabling tests for netcoreapp1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants