Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/AzSdk.reference.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.props'))" />
<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="[3.3.11, 4.0.0)" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="[3.3.10, 4.0.0)" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="[2.3.10, 3.0.0)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public void ServerCreateAsyncValidateMessage()
Assert.Equal(result.Location, AnalysisServicesTestUtilities.DefaultLocation);
Assert.NotEmpty(result.ServerFullName);

Assert.Equal(result.ProvisioningState, "Succeeded");
Assert.Equal(result.State, "Succeeded");
Assert.Equal(result.Tags.Count, 2);
Assert.Equal("Succeeded", result.ProvisioningState);
Assert.Equal("Succeeded", result.State);
Assert.Equal(2, result.Tags.Count);
}

[Fact]
Expand Down Expand Up @@ -99,9 +99,9 @@ public void ServerCreateSyncValidateMessage()
// Validate result
Assert.Equal(result.Location, AnalysisServicesTestUtilities.DefaultLocation);
Assert.NotEmpty(result.ServerFullName);
Assert.Equal(result.ProvisioningState, "Succeeded");
Assert.Equal(result.State, "Succeeded");
Assert.Equal(result.Tags.Count, 2);
Assert.Equal("Succeeded", result.ProvisioningState);
Assert.Equal("Succeeded", result.State);
Assert.Equal(2, result.Tags.Count);
Assert.Equal(result.BackupBlobContainerUri, AnalysisServicesTestUtilities.DefaultBackupBlobContainerUri);
}

Expand Down Expand Up @@ -153,9 +153,9 @@ public void ServerUpdateValidateMessage()
// Validate result
Assert.Equal(result.Location, AnalysisServicesTestUtilities.DefaultLocation);
Assert.NotEmpty(result.ServerFullName);
Assert.Equal(result.ProvisioningState, "Succeeded");
Assert.Equal(result.State, "Succeeded");
Assert.Equal(result.Tags.Count, 2);
Assert.Equal("Succeeded", result.ProvisioningState);
Assert.Equal("Succeeded", result.State);
Assert.Equal(2, result.Tags.Count);
Assert.Equal(result.BackupBlobContainerUri, AnalysisServicesTestUtilities.DefaultBackupBlobContainerUri);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ public void ScaleUpTest()
Console.WriteLine(ex.ToString());
}

Assert.Equal(resultCreate.ProvisioningState, "Succeeded");
Assert.Equal(resultCreate.State, "Succeeded");
Assert.Equal("Succeeded", resultCreate.ProvisioningState);
Assert.Equal("Succeeded", resultCreate.State);

// get the server and ensure that all the values are properly set.
var resultGet = client.Servers.GetDetails(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);
Expand Down Expand Up @@ -285,6 +285,223 @@ public void ScaleUpTest()
}
}

[Fact]
public void ScaleOutTest()
{
string executingAssemblyPath = typeof(AnalysisServices.Tests.ScenarioTests.ServerOperationsTests).GetTypeInfo().Assembly.Location;
HttpMockServer.RecordsDirectory = Path.Combine(Path.GetDirectoryName(executingAssemblyPath), "SessionRecords");
var defaultScaleOutCap = 2;
var s1SKU = "S1";
using (var context = MockContext.Start(this.GetType().FullName))
{
var client = this.GetAnalysisServicesClient(context);

AnalysisServicesServer analysisServicesServer = AnalysisServicesTestUtilities.GetDefaultAnalysisServicesResource();
SkuEnumerationForNewResourceResult skusListForNew = client.Servers.ListSkusForNew();
analysisServicesServer.Sku = skusListForNew.Value.Where((s) => s.Name == s1SKU).First();
analysisServicesServer.Sku.Capacity = defaultScaleOutCap;

AnalysisServicesServer resultCreate = null;
try
{
// Create a test server
resultCreate =
client.Servers.Create(
AnalysisServicesTestUtilities.DefaultResourceGroup,
AnalysisServicesTestUtilities.DefaultServerName,
analysisServicesServer);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

Assert.Equal("Succeeded", resultCreate.ProvisioningState);
Assert.Equal("Succeeded", resultCreate.State);

// get the server and ensure that all the values are properly set.
var resultGet = client.Servers.GetDetails(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);

// validate the server creation process
Assert.Equal(AnalysisServicesTestUtilities.DefaultLocation, resultGet.Location);
Assert.Equal(AnalysisServicesTestUtilities.DefaultServerName, resultGet.Name);
Assert.NotEmpty(resultGet.ServerFullName);
Assert.Equal(analysisServicesServer.Sku.Name, resultGet.Sku.Name);
Assert.Equal(2, resultGet.Tags.Count);
Assert.True(resultGet.Tags.ContainsKey("key1"));
Assert.Equal(2, resultGet.AsAdministrators.Members.Count);
Assert.Equal("Microsoft.AnalysisServices/servers", resultGet.Type);
Assert.Equal(2, resultGet.Sku.Capacity);

// Confirm that the server creation did succeed
Assert.True(resultGet.ProvisioningState == "Succeeded");
Assert.True(resultGet.State == "Succeeded");

// Scale in the server and verify
ResourceSku newSku = resultGet.Sku;
newSku.Capacity = 1;

AnalysisServicesServerUpdateParameters updateParameters = new AnalysisServicesServerUpdateParameters()
{
Sku = newSku
};

var resultUpdate = client.Servers.Update(
AnalysisServicesTestUtilities.DefaultResourceGroup,
AnalysisServicesTestUtilities.DefaultServerName,
updateParameters);

Assert.Equal("Succeeded", resultUpdate.ProvisioningState);
Assert.Equal("Succeeded", resultUpdate.State);
Assert.Equal(1, resultUpdate.Sku.Capacity);

// get the server and ensure that all the values are properly set.
resultGet = client.Servers.GetDetails(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);

// validate the server creation process
Assert.Equal(AnalysisServicesTestUtilities.DefaultLocation, resultGet.Location);
Assert.Equal(AnalysisServicesTestUtilities.DefaultServerName, resultGet.Name);
Assert.NotEmpty(resultGet.ServerFullName);
Assert.Equal(newSku.Name, resultGet.Sku.Name);
Assert.Equal(newSku.Tier, resultGet.Sku.Tier);
Assert.Equal(2, resultGet.Tags.Count);
Assert.True(resultGet.Tags.ContainsKey("key1"));
Assert.Equal(2, resultGet.AsAdministrators.Members.Count);
Assert.Equal("Microsoft.AnalysisServices/servers", resultGet.Type);
Assert.Equal(1, resultGet.Sku.Capacity);

// delete the server with its old name, which should also succeed.
client.Servers.Delete(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);
}
}

[Fact]
public void FirewallTest()
{
string executingAssemblyPath = typeof(AnalysisServices.Tests.ScenarioTests.ServerOperationsTests).GetTypeInfo().Assembly.Location;
HttpMockServer.RecordsDirectory = Path.Combine(Path.GetDirectoryName(executingAssemblyPath), "SessionRecords");
var s1SKU = "S1";
var sampleIPV4FirewallSetting = new IPv4FirewallSettings()
{
EnablePowerBIService = "True",
FirewallRules = new List<IPv4FirewallRule>()
{
new IPv4FirewallRule()
{
FirewallRuleName = "rule1",
RangeStart = "0.0.0.0",
RangeEnd = "255.255.255.255"
},
new IPv4FirewallRule()
{
FirewallRuleName = "rule2",
RangeStart = "7.7.7.7",
RangeEnd = "8.8.8.8"
},
}
};

using (var context = MockContext.Start(this.GetType().FullName))
{
var client = this.GetAnalysisServicesClient(context);

AnalysisServicesServer analysisServicesServer = AnalysisServicesTestUtilities.GetDefaultAnalysisServicesResource();
SkuEnumerationForNewResourceResult skusListForNew = client.Servers.ListSkusForNew();
analysisServicesServer.Sku = skusListForNew.Value.Where((s) => s.Name == s1SKU).First();
analysisServicesServer.IpV4FirewallSettings = sampleIPV4FirewallSetting;

AnalysisServicesServer resultCreate = null;
try
{
Console.Out.Write(analysisServicesServer.Sku.Capacity);
// Create a test server
resultCreate =
client.Servers.Create(
AnalysisServicesTestUtilities.DefaultResourceGroup,
AnalysisServicesTestUtilities.DefaultServerName,
analysisServicesServer);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

Assert.Equal("Succeeded", resultCreate.ProvisioningState);
Assert.Equal("Succeeded", resultCreate.State);

// get the server and ensure that all the values are properly set.
var resultGet = client.Servers.GetDetails(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);

// validate the server creation process
Assert.Equal(AnalysisServicesTestUtilities.DefaultLocation, resultGet.Location);
Assert.Equal(AnalysisServicesTestUtilities.DefaultServerName, resultGet.Name);
Assert.NotEmpty(resultGet.ServerFullName);
Assert.Equal(analysisServicesServer.Sku.Name, resultGet.Sku.Name);
Assert.Equal(2, resultGet.Tags.Count);
Assert.True(resultGet.Tags.ContainsKey("key1"));
Assert.Equal(2, resultGet.AsAdministrators.Members.Count);
Assert.Equal("Microsoft.AnalysisServices/servers", resultGet.Type);
Assert.Equal(sampleIPV4FirewallSetting.EnablePowerBIService, resultGet.IpV4FirewallSettings.EnablePowerBIService);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.Count(), resultGet.IpV4FirewallSettings.FirewallRules.Count());
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().FirewallRuleName, resultGet.IpV4FirewallSettings.FirewallRules.First().FirewallRuleName);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().RangeStart, resultGet.IpV4FirewallSettings.FirewallRules.First().RangeStart);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().RangeEnd, resultGet.IpV4FirewallSettings.FirewallRules.First().RangeEnd);

// Confirm that the server creation did succeed
Assert.True(resultGet.ProvisioningState == "Succeeded");
Assert.True(resultGet.State == "Succeeded");

// Update firewall and verify
ResourceSku newSku = resultGet.Sku;
sampleIPV4FirewallSetting.EnablePowerBIService = "False";
sampleIPV4FirewallSetting.FirewallRules = new List<IPv4FirewallRule>()
{
new IPv4FirewallRule()
{
FirewallRuleName = "rule3",
RangeStart = "6.6.6.6",
RangeEnd = "255.255.255.255"
}
};

AnalysisServicesServerUpdateParameters updateParameters = new AnalysisServicesServerUpdateParameters()
{
IpV4FirewallSettings = sampleIPV4FirewallSetting
};

var resultUpdate = client.Servers.Update(
AnalysisServicesTestUtilities.DefaultResourceGroup,
AnalysisServicesTestUtilities.DefaultServerName,
updateParameters);

Assert.Equal("Succeeded", resultUpdate.ProvisioningState);
Assert.Equal("Succeeded", resultUpdate.State);

// get the server and ensure that all the values are properly set.
resultGet = client.Servers.GetDetails(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);

// validate the server creation process
Assert.Equal(AnalysisServicesTestUtilities.DefaultLocation, resultGet.Location);
Assert.Equal(AnalysisServicesTestUtilities.DefaultServerName, resultGet.Name);
Assert.NotEmpty(resultGet.ServerFullName);
Assert.Equal(newSku.Name, resultGet.Sku.Name);
Assert.Equal(newSku.Tier, resultGet.Sku.Tier);
Assert.Equal(2, resultGet.Tags.Count);
Assert.True(resultGet.Tags.ContainsKey("key1"));
Assert.Equal(2, resultGet.AsAdministrators.Members.Count);
Assert.Equal("Microsoft.AnalysisServices/servers", resultGet.Type);
Assert.Equal(1, resultGet.Sku.Capacity);
Assert.Equal(sampleIPV4FirewallSetting.EnablePowerBIService, resultGet.IpV4FirewallSettings.EnablePowerBIService);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.Count(), resultGet.IpV4FirewallSettings.FirewallRules.Count());
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().FirewallRuleName, resultGet.IpV4FirewallSettings.FirewallRules.First().FirewallRuleName);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().RangeStart, resultGet.IpV4FirewallSettings.FirewallRules.First().RangeStart);
Assert.Equal(sampleIPV4FirewallSetting.FirewallRules.First().RangeEnd, resultGet.IpV4FirewallSettings.FirewallRules.First().RangeEnd);

// delete the server with its old name, which should also succeed.
client.Servers.Delete(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);
}
}

[Fact]
public void CreateServerWithGatewayTest()
{
Expand Down Expand Up @@ -335,7 +552,7 @@ public void CreateServerWithGatewayTest()
var listGatewayStatus = client.Servers.ListGatewayStatus(AnalysisServicesTestUtilities.DefaultResourceGroup,
AnalysisServicesTestUtilities.DefaultServerName);

Assert.Equal(listGatewayStatus.Status, Status.Live);
Assert.Equal(Status.Live, listGatewayStatus.Status);

// Dissociate gateway.
client.Servers.DissociateGateway(AnalysisServicesTestUtilities.DefaultResourceGroup, AnalysisServicesTestUtilities.DefaultServerName);
Expand Down
Loading