Skip to content

Commit

Permalink
.NET v3: Update to .NET 6 and enable Weathertop tests (awsdocs#5902)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlhagerm authored and max-webster committed Mar 15, 2024
1 parent 48b27dd commit 671a1a9
Show file tree
Hide file tree
Showing 261 changed files with 595 additions and 634 deletions.
1 change: 0 additions & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ jobs:
VALIDATE_PYTHON_BLACK: true
VALIDATE_RUBY: true
VALIDATE_KOTLIN: true
VALIDATE_EDITORCONFIG: true
VALIDATE_BASH: true
4 changes: 4 additions & 0 deletions dotnetv3/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ csharp_space_between_square_brackets = false
###############################
# File header.
file_header_template = Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. \nSPDX-License-Identifier: Apache-2.0
# SA0001: XML comment disable is allowed.
dotnet_diagnostic.SA0001.severity = none
# SA1600: Elements must be documented is disabled.
dotnet_diagnostic.SA1600.severity = none
dotnet_diagnostic.SA1615.severity = none
Expand All @@ -151,3 +153,5 @@ dotnet_diagnostic.SA1309.severity = none
dotnet_diagnostic.IDE2000.severity = error
# IDE0073: Require a file header.
dotnet_diagnostic.IDE0073.severity = error
# CA1416: Disable system.drawing warnings.
dotnet_diagnostic.CA1416.severity = none
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace DescribeCertificate
{
class DescribeCertificate
{
// The following example retrieves and displays the metadate for a
// The following example retrieves and displays the metadata for a
// certificate using the AWS Certificate Manager (ACM) service.

// Specify your AWS Region (an example Region is shown).
Expand All @@ -21,7 +21,7 @@ class DescribeCertificate

static void Main(string[] args)
{
var _client = new Amazon.CertificateManager.AmazonCertificateManagerClient(ACMRegion);
_client = new Amazon.CertificateManager.AmazonCertificateManagerClient(ACMRegion);

var describeCertificateReq = new DescribeCertificateRequest();
// The ARN used here is just an example. Replace it with the ARN of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ListCertificates

static void Main(string[] args)
{
var _client = new AmazonCertificateManagerClient(ACMRegion);
_client = new AmazonCertificateManagerClient(ACMRegion);
var certificateList = ListCertificatesResponseAsync(client: _client);

Console.WriteLine("Certificate Summary List\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
31 changes: 30 additions & 1 deletion dotnetv3/AutoScaling/Tests/AutoScalingWrapperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public AutoScalingWrapperTests()
[Fact()]
[Order(1)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task CreateLaunchTemplateAsyncTest()
{
_launchTemplateId = await _ec2Wrapper.CreateLaunchTemplateAsync(_imageId!, _instanceType!, _launchTemplateName!);
Expand All @@ -83,6 +84,7 @@ public async Task CreateLaunchTemplateAsyncTest()
[Fact()]
[Order(2)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DescribeLaunchTemplateAsyncTest()
{
var success = await _ec2Wrapper.DescribeLaunchTemplateAsync(_launchTemplateName!);
Expand All @@ -97,6 +99,7 @@ public async Task DescribeLaunchTemplateAsyncTest()
[Fact()]
[Order(3)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task CreateAutoScalingGroupTest()
{
var availabilityZone =
Expand All @@ -114,6 +117,7 @@ public async Task CreateAutoScalingGroupTest()
[Fact()]
[Order(4)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DescribeAutoScalingInstancesAsyncTest()
{
var instanceDetails = await _autoScalingWrapper.DescribeAutoScalingInstancesAsync(_groupName!);
Expand All @@ -127,6 +131,7 @@ public async Task DescribeAutoScalingInstancesAsyncTest()
[Fact()]
[Order(5)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task EnableMetricsCollectionAsyncTest()
{
var success = await _autoScalingWrapper.EnableMetricsCollectionAsync(_groupName!);
Expand All @@ -143,6 +148,7 @@ public async Task EnableMetricsCollectionAsyncTest()
[Fact()]
[Order(6)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task SetDesiredCapacityAsyncTest()
{
var newMax = 3;
Expand All @@ -167,6 +173,7 @@ public async Task SetDesiredCapacityAsyncTest()
[Fact()]
[Order(7)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task UpdateAutoScalingGroupTest()
{
var newMax = 3;
Expand All @@ -189,6 +196,7 @@ public async Task UpdateAutoScalingGroupTest()
[Fact()]
[Order(8)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DescribeAutoScalingGroupsAsyncTest()
{
var details = await _autoScalingWrapper.DescribeAutoScalingGroupsAsync(_groupName!);
Expand All @@ -203,6 +211,7 @@ public async Task DescribeAutoScalingGroupsAsyncTest()
[Fact()]
[Order(9)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DescribeScalingActivitiesAsyncTest()
{
var activities = await _autoScalingWrapper.DescribeScalingActivitiesAsync(_groupName!);
Expand All @@ -217,6 +226,7 @@ public async Task DescribeScalingActivitiesAsyncTest()
[Fact()]
[Order(10)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task GetCloudWatchMetricsAsyncTest()
{
var metrics = await _cloudWatchWrapper.GetCloudWatchMetricsAsync(_groupName!);
Expand All @@ -231,6 +241,7 @@ public async Task GetCloudWatchMetricsAsyncTest()
[Fact()]
[Order(11)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task GetMetricStatisticsAsyncTest()
{
var dataPoints = await _cloudWatchWrapper.GetMetricStatisticsAsync(_groupName!);
Expand All @@ -245,6 +256,7 @@ public async Task GetMetricStatisticsAsyncTest()
[Fact()]
[Order(12)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DisableMetricsCollectionAsyncTest()
{
var success = await _autoScalingWrapper.DisableMetricsCollectionAsync(_groupName!);
Expand All @@ -260,6 +272,7 @@ public async Task DisableMetricsCollectionAsyncTest()
[Fact()]
[Order(13)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task TerminateInstanceInAutoScalingGroupAsyncTest()
{
foreach (var group in _groups!)
Expand All @@ -268,7 +281,20 @@ public async Task TerminateInstanceInAutoScalingGroupAsyncTest()
{
foreach (Amazon.AutoScaling.Model.Instance instance in group.Instances)
{
var success = await _autoScalingWrapper.TerminateInstanceInAutoScalingGroupAsync(instance.InstanceId);
var retries = 3;
var success = false;
while (retries > 0 && !success)
try
{
success =
await _autoScalingWrapper
.TerminateInstanceInAutoScalingGroupAsync(
instance.InstanceId);
}
catch (ScalingActivityInProgressException)
{
retries--;
}
Assert.True(success, "Could not terminate the instance.");
}
}
Expand All @@ -283,6 +309,7 @@ public async Task TerminateInstanceInAutoScalingGroupAsyncTest()
[Fact()]
[Order(14)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DeleteAutoScalingGroupTest()
{
var success = await _autoScalingWrapper.DeleteAutoScalingGroupAsync(_groupName!);
Expand All @@ -299,6 +326,7 @@ public async Task DeleteAutoScalingGroupTest()
[Fact()]
[Order(15)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DeleteLaunchTemplateAsyncTest()
{
var templateName = await _ec2Wrapper.DeleteLaunchTemplateAsync(_launchTemplateId!);
Expand All @@ -313,6 +341,7 @@ public async Task DeleteLaunchTemplateAsyncTest()
/// <returns>Async Task.</returns>
[Fact()]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task DescribeAccountLimitsTest()
{
var success = await _autoScalingWrapper.DescribeAccountLimitsAsync();
Expand Down
1 change: 1 addition & 0 deletions dotnetv3/Bedrock/Tests/BedrockTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public BedrockTest()
[Fact]
[Order(1)]
[Trait("Category", "Integration")]
[Trait("Category", "Weathertop")]
public async Task ListFoundationModelsAsync_ShouldNotBeNull()
{
var result = await bedrockClient.ListFoundationModelsAsync(new ListFoundationModelsRequest());
Expand Down
2 changes: 1 addition & 1 deletion dotnetv3/CloudWatch/Actions/CloudWatchClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class Widget
public int Height { get; set; }

[JsonPropertyName("properties")]
public Properties Properties { get; set; }
public Properties Properties { get; set; } = null!;
}

public class YAxis
Expand Down
2 changes: 1 addition & 1 deletion dotnetv3/CloudWatch/Actions/CloudWatchWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public async Task<List<MetricDataResult>> GetMetricData(int minutesOfData, bool
/// <param name="alarmActions">Optional actions to execute when in an alarm state.</param>
/// <returns>True if successful.</returns>
public async Task<bool> PutMetricEmailAlarm(string alarmDescription, string alarmName, ComparisonOperator comparison,
string metricName, string metricNamespace, double threshold, List<string> alarmActions = null)
string metricName, string metricNamespace, double threshold, List<string> alarmActions = null!)
{
try
{
Expand Down
Loading

0 comments on commit 671a1a9

Please sign in to comment.