Skip to content
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

Merged
merged 8 commits into from
Nov 16, 2016
Merged

SDK changes to support ADLS as option for default storage #2484

merged 8 commits into from
Nov 16, 2016

Conversation

srsiva
Copy link

@srsiva srsiva commented Oct 20, 2016

This pull request contains the HDInsight SDK changes to support ADL as an option for default storage; for HDInsight clusters

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@azurecla
Copy link

Hi @srsiva, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!


It looks like you're working at Microsoft (sisankar). If you're full-time, we DON'T require a contribution license agreement.



If you are a vendor, DO please sign the electronic contribution license agreement. It will take 2 minutes and there's no faxing! https://cla.azure.com.

TTYL, AZPRBOT;

@hovsepm
Copy link
Contributor

hovsepm commented Oct 21, 2016

@azuresdkci test this please

@markcowl
Copy link
Member

@shefaliv can you take a look?

Copy link
Member

@markcowl markcowl left a 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>
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Author

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; }

Copy link
Member

@markcowl markcowl Oct 26, 2016

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.

Copy link
Author

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 ?

Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

@markcowl,

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";
Copy link
Contributor

Choose a reason for hiding this comment

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

2.0.0

Copy link
Member

Choose a reason for hiding this comment

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

@srsive please update.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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";
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Author

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

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

@markcowl , there are no changes for this comment. @shefaliv to confirm.

Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Author

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

should be unit test

Copy link
Author

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.

Copy link
Author

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.

Copy link
Author

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()
{
Copy link
Contributor

Choose a reason for hiding this comment

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

unit test

Copy link
Author

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.

  1. public async Task CreateAsync(string resourceGroupName, string clusterName, ClusterCreateParameters clusterCreateParameters, CancellationToken cancellationToken)
  2. public async Task CreateAsync(string resourceGroupName, string clusterName, ClusterCreateParametersExtended clusterCreateParameters, CancellationToken cancellationToken)

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

Choose a reason for hiding this comment

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

fixed via d13fedd

@markcowl
Copy link
Member

@azuresdkci add to whitelist

@srsiva
Copy link
Author

srsiva commented Nov 3, 2016

Hi @markcowl.

All comments thus far have been addressed.
Could you please review and merge in the pull request ?

Thanks,
Siva

@markcowl
Copy link
Member

markcowl commented Nov 3, 2016

@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";
Copy link
Contributor

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>
Copy link
Contributor

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);

Copy link
Contributor

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?

Copy link
Author

@srsiva srsiva Nov 8, 2016

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";
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

format string

Copy link
Author

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: ";
Copy link
Contributor

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: ";
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Author

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. remove.

Copy link
Author

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)
Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

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)
Copy link
Contributor

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

Copy link
Author

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)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

where are these fixes?

@markcowl
Copy link
Member

@srsiva @shefaliv Shefali needs to sign off on her review

@cormacpayne
Copy link
Member

@srsiva please resolve the merge conflicts and update the PR

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.

8 participants