From f0519b4b0cbe4dc32e0cf9305efa341ba0fca06a Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 21 Dec 2020 09:07:33 -0600 Subject: [PATCH] [synapse] Re-enable many disabled tests by bumping to swagger with nullability fix (#17645) - This fixes almost all of https://github.com/Azure/azure-sdk-for-net/issues/17455 - Two tests remain: A managed private endpoint issue that's been raised w\ the service team and a pipeline test that I'm rewriting in another PR --- .../src/autorest.md | 2 +- .../Generated/Models/NotebookCell.Serialization.cs | 13 ++++++++++--- .../Models/NotebookMetadata.Serialization.cs | 13 ++++++++++--- .../Models/SparkScheduler.Serialization.cs | 4 ++-- .../src/autorest.md | 2 +- .../tests/NotebookClientLiveTests.cs | 1 - .../tests/samples/NotebookSampleSnippets.cs | 1 - .../tests/samples/Sample2_CreateNotebook.cs | 1 - .../src/autorest.md | 2 +- .../tests/ManagedPrivateEndpointsClientLiveTests.cs | 2 +- .../tests/samples/SampleSnippets.cs | 1 - .../src/Generated/Models/SparkJob.Serialization.cs | 8 ++++---- .../src/autorest.md | 2 +- .../tests/MonitoringClientLiveTests.cs | 1 - .../tests/samples/Sample1_PipelineMonitoring.cs | 1 - .../tests/samples/SampleSnippets.cs | 1 - .../Models/SparkScheduler.Serialization.cs | 4 ++-- .../Models/SparkStatement.Serialization.cs | 2 +- .../Models/SparkStatementOutput.Serialization.cs | 12 +++++++++++- .../Azure.Analytics.Synapse.Spark/src/autorest.md | 2 +- .../tests/samples/Sample2_ExecuteSparkStatement.cs | 1 - 21 files changed, 46 insertions(+), 30 deletions(-) diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md index 71b13c00d913c..d4d4276ed2910 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. > see https://aka.ms/autorest ```yaml -repo: https://github.com/Azure/azure-rest-api-specs/blob/eea7c0141c0b7ad9f66f8ba06560b549c6b3b014 +repo: https://github.com/Azure/azure-rest-api-specs/blob/ca0ac888f84b97feaef05fad6632f41ef1a399e6 ``` ``` yaml diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookCell.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookCell.Serialization.cs index 6010d4ada7c62..63c361dd2dc5b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookCell.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookCell.Serialization.cs @@ -29,8 +29,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndArray(); if (Optional.IsDefined(Attachments)) { - writer.WritePropertyName("attachments"); - writer.WriteObjectValue(Attachments); + if (Attachments != null) + { + writer.WritePropertyName("attachments"); + writer.WriteObjectValue(Attachments); + } + else + { + writer.WriteNull("attachments"); + } } if (Optional.IsCollectionDefined(Outputs)) { @@ -85,7 +92,7 @@ internal static NotebookCell DeserializeNotebookCell(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + attachments = null; continue; } attachments = property.Value.GetObject(); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookMetadata.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookMetadata.Serialization.cs index a0fdc24c9cdc6..0e4ff49d763cd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookMetadata.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/NotebookMetadata.Serialization.cs @@ -23,8 +23,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } if (Optional.IsDefined(LanguageInfo)) { - writer.WritePropertyName("language_info"); - writer.WriteObjectValue(LanguageInfo); + if (LanguageInfo != null) + { + writer.WritePropertyName("language_info"); + writer.WriteObjectValue(LanguageInfo); + } + else + { + writer.WriteNull("language_info"); + } } foreach (var item in AdditionalProperties) { @@ -56,7 +63,7 @@ internal static NotebookMetadata DeserializeNotebookMetadata(JsonElement element { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + languageInfo = null; continue; } languageInfo = NotebookLanguageInfo.DeserializeNotebookLanguageInfo(property.Value); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SparkScheduler.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SparkScheduler.Serialization.cs index f14094409d007..654fdc2415bf5 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SparkScheduler.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/SparkScheduler.Serialization.cs @@ -18,7 +18,7 @@ internal static SparkScheduler DeserializeSparkScheduler(JsonElement element) Optional submittedAt = default; Optional scheduledAt = default; Optional endedAt = default; - Optional cancellationRequestedAt = default; + Optional cancellationRequestedAt = default; Optional currentState = default; foreach (var property in element.EnumerateObject()) { @@ -56,7 +56,7 @@ internal static SparkScheduler DeserializeSparkScheduler(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + cancellationRequestedAt = null; continue; } cancellationRequestedAt = property.Value.GetDateTimeOffset("O"); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md index 760f0f60cd24f..24b772544222e 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. > see https://aka.ms/autorest ```yaml -repo: https://github.com/Azure/azure-rest-api-specs/tree/eea7c0141c0b7ad9f66f8ba06560b549c6b3b014 +repo: https://github.com/Azure/azure-rest-api-specs/tree/ca0ac888f84b97feaef05fad6632f41ef1a399e6 ``` ``` yaml diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/NotebookClientLiveTests.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/NotebookClientLiveTests.cs index 0adc81ea6744c..f63bc38ee3972 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/NotebookClientLiveTests.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/NotebookClientLiveTests.cs @@ -26,7 +26,6 @@ public NotebookClientLiveTests(bool isAsync) : base(isAsync) { } - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] [Test] public async Task TestGetNotebook() { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/NotebookSampleSnippets.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/NotebookSampleSnippets.cs index ba076b8591a21..c3f4cb8c02fe5 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/NotebookSampleSnippets.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/NotebookSampleSnippets.cs @@ -13,7 +13,6 @@ namespace Azure.Analytics.Synapse.Artifacts.Samples { public partial class NotebookSnippets : SampleFixture { - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] [Test] public async Task NotebookSample() { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/Sample2_CreateNotebook.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/Sample2_CreateNotebook.cs index 8330fa027c7e4..0053f64e18646 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/Sample2_CreateNotebook.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/tests/samples/Sample2_CreateNotebook.cs @@ -16,7 +16,6 @@ namespace Azure.Analytics.Synapse.Samples /// public partial class NotebookSample { - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] [Test] public async Task CreateAndUploadNotebook() { diff --git a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/autorest.md index a05e22c51b632..8a409180dc430 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet msbuild /t:GenerateCode` to generate code. > see https://aka.ms/autorest ```yaml -repo: https://github.com/Azure/azure-rest-api-specs/blob/eea7c0141c0b7ad9f66f8ba06560b549c6b3b014 +repo: https://github.com/Azure/azure-rest-api-specs/blob/ca0ac888f84b97feaef05fad6632f41ef1a399e6 ``` ``` yaml diff --git a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/ManagedPrivateEndpointsClientLiveTests.cs b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/ManagedPrivateEndpointsClientLiveTests.cs index fa6004928ea50..e3b9ebf52a429 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/ManagedPrivateEndpointsClientLiveTests.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/ManagedPrivateEndpointsClientLiveTests.cs @@ -27,8 +27,8 @@ public ManagedPrivateEndpointsClientLiveTests(bool isAsync) : base(isAsync) { } - [Test] [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] + [Test] public async Task TestManagedPrivateEndpoints() { // Create a managed private endpoint diff --git a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/samples/SampleSnippets.cs b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/samples/SampleSnippets.cs index 25374cafa3b34..2277236de272f 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/samples/SampleSnippets.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/tests/samples/SampleSnippets.cs @@ -14,7 +14,6 @@ namespace Azure.Analytics.Synapse.ManagedPrivateEndpoints.Samples public partial class Snippets : SampleFixture { [Test] - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] public void TestManagedPrivateEndpoint() { #region Snippet:CreateClient diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Generated/Models/SparkJob.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Generated/Models/SparkJob.Serialization.cs index 6027aa6d69004..ebfb502c04265 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Generated/Models/SparkJob.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/Generated/Models/SparkJob.Serialization.cs @@ -26,8 +26,8 @@ internal static SparkJob DeserializeSparkJob(JsonElement element) Optional sparkJobDefinition = default; Optional> pipeline = default; Optional jobType = default; - Optional submitTime = default; - Optional endTime = default; + Optional submitTime = default; + Optional endTime = default; Optional queuedDuration = default; Optional runningDuration = default; Optional totalDuration = default; @@ -112,7 +112,7 @@ internal static SparkJob DeserializeSparkJob(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + submitTime = null; continue; } submitTime = property.Value.GetDateTimeOffset("O"); @@ -122,7 +122,7 @@ internal static SparkJob DeserializeSparkJob(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + endTime = null; continue; } endTime = property.Value.GetDateTimeOffset("O"); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/autorest.md index 85df5f166ba4f..6748d8e54d28b 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet msbuild /t:GenerateCode` to generate code. > see https://aka.ms/autorest ```yaml -repo: https://github.com/Azure/azure-rest-api-specs/tree/eea7c0141c0b7ad9f66f8ba06560b549c6b3b014 +repo: https://github.com/Azure/azure-rest-api-specs/tree/ca0ac888f84b97feaef05fad6632f41ef1a399e6 ``` ``` yaml diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/MonitoringClientLiveTests.cs b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/MonitoringClientLiveTests.cs index e8be3a14b978b..10156171cc11f 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/MonitoringClientLiveTests.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/MonitoringClientLiveTests.cs @@ -25,7 +25,6 @@ public MonitoringClientLiveTests(bool isAsync) : base(isAsync) } [Test] - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] public async Task TestListSparkApplications() { SparkJobListViewResponse sparkJobList = await MonitoringClient.GetSparkJobListAsync(); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/Sample1_PipelineMonitoring.cs b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/Sample1_PipelineMonitoring.cs index 8fc22cd985b06..0c1089ca69962 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/Sample1_PipelineMonitoring.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/Sample1_PipelineMonitoring.cs @@ -17,7 +17,6 @@ namespace Azure.Analytics.Synapse.Samples /// public partial class PipelineMonitoring { - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] [Test] public void MonitorPipelineRuns() { diff --git a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/SampleSnippets.cs b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/SampleSnippets.cs index 172440f77b4fe..5e9bbe8729ff5 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/SampleSnippets.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Monitoring/tests/samples/SampleSnippets.cs @@ -12,7 +12,6 @@ namespace Azure.Analytics.Synapse.Monitoring.Samples public partial class Snippets : SampleFixture { [Test] - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] public void MonitoringSample() { #region Snippet:CreateMonitoringClient diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkScheduler.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkScheduler.Serialization.cs index d273859c98f93..31c241b34669f 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkScheduler.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkScheduler.Serialization.cs @@ -18,7 +18,7 @@ internal static SparkScheduler DeserializeSparkScheduler(JsonElement element) Optional submittedAt = default; Optional scheduledAt = default; Optional endedAt = default; - Optional cancellationRequestedAt = default; + Optional cancellationRequestedAt = default; Optional currentState = default; foreach (var property in element.EnumerateObject()) { @@ -56,7 +56,7 @@ internal static SparkScheduler DeserializeSparkScheduler(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + cancellationRequestedAt = null; continue; } cancellationRequestedAt = property.Value.GetDateTimeOffset("O"); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatement.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatement.Serialization.cs index 69b8989343308..b845803c47425 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatement.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatement.Serialization.cs @@ -39,7 +39,7 @@ internal static SparkStatement DeserializeSparkStatement(JsonElement element) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + output = null; continue; } output = SparkStatementOutput.DeserializeSparkStatementOutput(property.Value); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatementOutput.Serialization.cs b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatementOutput.Serialization.cs index e0ca1c65cc41a..331e21a7e216d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatementOutput.Serialization.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/Generated/Models/SparkStatementOutput.Serialization.cs @@ -45,11 +45,21 @@ internal static SparkStatementOutput DeserializeSparkStatementOutput(JsonElement } if (property.NameEquals("ename")) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + ename = null; + continue; + } ename = property.Value.GetString(); continue; } if (property.NameEquals("evalue")) { + if (property.Value.ValueKind == JsonValueKind.Null) + { + evalue = null; + continue; + } evalue = property.Value.GetString(); continue; } @@ -57,7 +67,7 @@ internal static SparkStatementOutput DeserializeSparkStatementOutput(JsonElement { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); + traceback = null; continue; } List array = new List(); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/autorest.md index 981934b683f9b..e02557f29f359 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/src/autorest.md @@ -6,7 +6,7 @@ Run `dotnet build /t:GenerateCode` to generate code. > see https://aka.ms/autorest ```yaml -repo: https://github.com/Azure/azure-rest-api-specs/blob/eea7c0141c0b7ad9f66f8ba06560b549c6b3b014 +repo: https://github.com/Azure/azure-rest-api-specs/blob/ca0ac888f84b97feaef05fad6632f41ef1a399e6 ``` ``` yaml diff --git a/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/samples/Sample2_ExecuteSparkStatement.cs b/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/samples/Sample2_ExecuteSparkStatement.cs index 4affdb6183ded..3ebe8f37fba93 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/samples/Sample2_ExecuteSparkStatement.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Spark/tests/samples/Sample2_ExecuteSparkStatement.cs @@ -18,7 +18,6 @@ namespace Azure.Analytics.Synapse.Samples public partial class ExecuteSparkStatement { [Test] - [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/17455")] public void ExecuteSparkStatementSync() { // Environment variable with the Synapse workspace endpoint.