-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
SDK changes to support ADLS as option for default storage #2484
Conversation
Can one of the admins verify this patch? |
Hi @srsiva, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!
TTYL, AZPRBOT; |
@azuresdkci test this please |
@shefaliv can you take a look? |
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.
Please reapond to comment
@@ -2,8 +2,8 @@ | |||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<ItemGroup> | |||
<SdkNuGetPackage Include="Microsoft.Azure.Management.HDInsight"> | |||
<PackageVersion>1.3.0</PackageVersion> | |||
<PackageVersion>2.0.0</PackageVersion> |
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.
It doesn't look like there are breaking changes in this API, why the major version increase?
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 a breaking change for default storage. Hence the major version bump.
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 isn't a breaking change until the old properties are removed. Then the version bump will be needed.
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.
Some fields have been obsoleted in ClusterCreateParameters; making this a breaking change for all users of the SDK. Hence the major version bump.
src\resourcemanagement\hdinsight\hdinsight\customizationmodels\clustercreateparameters.cs:
[ObsoleteAttribute("This property is deprecated. Please use AzureStorageInfo with the DefaultStorageInfo parameter instead.", true)]
public string DefaultStorageAccountName { get; set; }
/// <summary>
/// Gets or sets the StorageKey for the default Azure Storage Account.
/// This account will be used for schemaless paths and the cluster will
/// leverage to store some cluster level files.
/// </summary>
[ObsoleteAttribute("This property is deprecated. Please use AzureStorageInfo with the DefaultStorageInfo parameter instead.", true)]
public string DefaultStorageAccountKey { get; set; }
/// <summary>
/// Gets or sets the StorageContainer for the default Azure Storage Account.
/// This account will be used for schemaless paths and the cluster will
/// leverage to store some cluster level files.
/// </summary>
[ObsoleteAttribute("This property is deprecated. Please use AzureStorageInfo with the DefaultStorageInfo parameter instead.", true)]
public string DefaultStorageContainer { get; set; }
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 does not make it a breaking change. Removing the fields will make it a breaking change.
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.
@markcowl -- can you confirm if we are closed on your original comment about why a major version increase was required ?
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.
These are throwing because you sepcified the second attribute as 'true', see:
For details on the absolete attribute, see: https://msdn.microsoft.com/en-us/library/22kk2b44(v=vs.90).aspx
If these properties no longer work then this is a breaking change. You will need to have a p;lan to mitigate this break in azure powershell if you plan to use that library there. Please acknowledge and then this issue will be resolved.
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.
Yes ... the second attribute was specified as 'true' to force this to be a breaking change -- to make this an error (with appropriate error message to help the user to transition to the new way of specifying clusterCreateParams).
These properties no longer work .. any reference to these properties in the source code, will result in a compile error as shown in the image above.
Yes .. we already have the corresponding changes to azure powershell ready, that incorporates these (breaking) changes. I'll send out a pull request for the powershell changes as soon as this one is done.
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.
@srsiva There will be no breaking changes in the next version of PowerShell. You must mitigate any breaks in the PowerShell API surface with code, or you will not be able to merge this library into PowerShell. There are several strategies for mtigating breaking changes. Please contact ius if you have questions abotu this. Otherwise ack and this is OK from our perspective.
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.
The breaks in Powershell API due to this change will be handled in a separate pull request. I'll send out a pull request with the corresponding changes to powershell, shortly. It is not a breaking change in as far as powershell is concerned.
Powershell seems to be taking a dependency on SDK via nuget packages (and the corresponding dll reference). Merging in this change should not affect powershell unless we publish the SDK nuget pkg and consume it in powershell code; and release a newer version of powershell.
@@ -43,6 +43,8 @@ namespace Microsoft.Azure.Management.HDInsight | |||
/// </summary> | |||
internal partial class ClusterOperations : IServiceOperations<HDInsightManagementClient>, IClusterOperations | |||
{ | |||
private const string _userAgentString = "ARM SDK v2.0"; |
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.
2.0.0
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.
@srsive please update.
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.
fixed - will be included in the upcoming PR.
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.
You need to add the changes here. This PR will not be accepted without requested changes.
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.
@markcowl , I have added the changes to this PR.
@@ -22,6 +22,8 @@ namespace HDInsight.Tests.Helpers | |||
{ | |||
public static class GetClusterSpecHelpers | |||
{ | |||
private const string ADLClusterRootPath = "/Clusters/SDK"; |
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.
nit. can you remove this from here please? The values up here are just here because htey have to be set for recording. Can you please separate out the variable that's already been set?
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 value is required for recording too.
The value set here is included in the CSM request that is sent out.
This value is required by the AzureDataLakeStoreInfo constructor - please see GetClusterSpecHelpers.cs:GetDefaultAzureDataLakeStoreInfo() for details.
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.
Waiting for confirmation from @shefaliv, so that I can include the changes (if any) in the upcoming PR.
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.
You need to add the changes here. This PR will not be accepted without requested changes.
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.
Right but it's not a value that has to be configured when recording and can be committed. The variables up here are just hte variables that have to be manually set for recording at the time of recording.
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.
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.
@shefaliv please confirm if we can close out this comment.
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.
@srsiva why are there no changes needed?
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 fixed now. I moved this variable within the test.
} | ||
|
||
[Fact] | ||
public void TestCreateDefaultFsAzureBlobClusterContainerNotSpecified() |
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.
should be unit test
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.
It is not possible to convert this to a unit test.
Same reason as above.
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.
@shefaliv , pls. confirm and close the comment.
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.
fixed via d13fedd
|
||
[Fact] | ||
public void TestCreateDefaultFsAzureBlobClusterUsingClusterParameters() | ||
{ |
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.
unit test
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.
It is not possible to convert this to a unit test.
To convert to a unit test, I need to be able to setup a mock of IClusterOperations that actually executes the body of #1 below and verifies the call on #2 below.
When #1 completes executing, it would have created a ClusterCreateParametersExtended object and passed it as an argument to #2. We could then have called Mock.Verify with It.Is on #2.
Unfortunately, I dont think it is possible to setup the mock to fully execute certain methods (as though no mocking was setup) and mock the others.
- public async Task CreateAsync(string resourceGroupName, string clusterName, ClusterCreateParameters clusterCreateParameters, CancellationToken cancellationToken)
- public async Task CreateAsync(string resourceGroupName, string clusterName, ClusterCreateParametersExtended clusterCreateParameters, CancellationToken cancellationToken)
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.
@shefaliv , pls. confirm and close the comment.
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.
@srsiva You need to mock CreateWhithHttpMessagesAsync - it is possible to mock some methods and not others by using an instance of the actual client in your Mock to make the actual API call, while using a mock response for other methods.
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.
fixed via d13fedd
@azuresdkci add to whitelist |
Hi @markcowl. All comments thus far have been addressed. Thanks, |
@srsive, please see my comment, and shefali must also sign off. |
@@ -22,6 +22,8 @@ namespace HDInsight.Tests.Helpers | |||
{ | |||
public static class GetClusterSpecHelpers | |||
{ | |||
private const string ADLClusterRootPath = "/Clusters/SDK"; |
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.
Right but it's not a value that has to be configured when recording and can be committed. The variables up here are just hte variables that have to be manually set for recording at the time of recording.
@@ -2,8 +2,8 @@ | |||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<ItemGroup> | |||
<SdkNuGetPackage Include="Microsoft.Azure.Management.HDInsight"> | |||
<PackageVersion>1.3.0</PackageVersion> | |||
<PackageVersion>2.0.0</PackageVersion> |
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.
I'll let Matthew make this call. As far as customers are concerned, this is a breaking change because using these fields will throw an error. It's the same behavior as it would be if the fields were removed, just with a more actionable error. In my opinion, the version should be a major version bump because that will indicate to customers that they will have to change their scripts when they upgrade to this and will not be able to use their already existing scripts.
clusterOperationsMock = new Mock<ClusterOperations>(clientMock.Object); | ||
|
||
clientMock.SetupGet(c => c.Clusters).Returns(clusterOperationsMock.Object); | ||
|
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.
I sent you an email about what I expect from the unit tests. Can you please address that?
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 was already fixed in 056de19.
@@ -22,6 +22,8 @@ namespace HDInsight.Tests.Helpers | |||
{ | |||
public static class GetClusterSpecHelpers | |||
{ | |||
private const string ADLClusterRootPath = "/Clusters/SDK"; |
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.
@srsiva why are there no changes needed?
string mooncakeStorageNameFqdn = "testblob.blob.core.chinacloudapi.cn"; | ||
string existingStorageKey = "testtest=="; | ||
string containerName = "testcontainer"; | ||
string existingStorageNameFqdnUri = "wasb://" + containerName +"@" + existingStorageNameFqdn; |
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.
format string
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.
fixed.
string existingStorageKey = "testtest=="; | ||
string containerName = "testcontainer"; | ||
string existingStorageNameFqdnUri = "wasb://" + containerName +"@" + existingStorageNameFqdn; | ||
string paramErrorMessage = "Input cannot be empty\r\nParameter name: "; |
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.
are there constant strings you can refer to rather than hard coding this here? Otherwise changing this error will require changes in two places.
string existingDatalakeStorageShortName = "test"; | ||
string existingDatalakeStorageNameFqdn = "test.azuredatalakestore.net"; | ||
string existingDatalakeStorageNameFqdnUri = "adl://" + existingDatalakeStorageNameFqdn; | ||
string paramErrorMessage = "Input cannot be empty\r\nParameter name: "; |
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.
are there constant strings you can refer to rather than hard coding this here? Otherwise changing this error will require changes in two places.
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.
Also below in this file
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.
fixed
{ | ||
public class ClusterCreateTests | ||
{ | ||
public ClusterCreateTests() |
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.
nit. remove.
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.
fixed.
Assert.True(ContainerMatchesNameProvided(extendedParams, clusterName), "Container name does not match the cluster name"); | ||
} | ||
|
||
private bool ContainerMatchesNameProvided(ClusterCreateParametersExtended x, string name) |
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.
you can just make this AssertContainerMatchesNameProvided and put the assert.true in here so each calling method doesn't have to
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.
I have two different messages when the assert fails. I would rather leave it the way it is.
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.
If you really need two different errors, then please pass that in, though in my opinion the regular assert failure is fine.
Either way, I'd rather have it be self sufficient rather than forcing the user to assert when that is the only purpose this serves.
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.
fixed
Assert.True(ContainerMatchesNameProvided(extendedParams, clusterName), "Container name does not match the cluster name"); | ||
} | ||
|
||
private bool ContainerMatchesNameProvided(ClusterCreateParametersExtended x, string name) |
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.
better name than x please
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.
fixed.
Assert.True(ContainerMatchesNameProvided(extendedParams, clusterName), "Container name does not match the cluster name"); | ||
} | ||
|
||
private bool ContainerMatchesNameProvided(ClusterCreateParametersExtended x, string name) |
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.
If you really need two different errors, then please pass that in, though in my opinion the regular assert failure is fine.
Either way, I'd rather have it be self sufficient rather than forcing the user to assert when that is the only purpose this serves.
); | ||
} | ||
|
||
private void testAndAssert(Func<StorageInfo> func, string msg) |
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.
where are these fixes?
@srsiva please resolve the merge conflicts and update the PR |
This pull request contains the HDInsight SDK changes to support ADL as an option for default storage; for HDInsight clusters