From 64e79f548b0c246c51158ef336ebce43ad71716b Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Fri, 8 Mar 2019 13:52:16 -0800 Subject: [PATCH 1/2] Enable WarnAsError for official builds Fixes a few existing warnings: - Disables semver 2 nuget package version warning - Commented out some test code that is giving warnings about not being marked as Fact. Will fill a follow-up issues about those tests. --- .azure-pipelines/client.yml | 2 + eng/Directory.Build.Data.props | 5 ++ .../KeyVaultOperationsTest.cs | 46 +++++++++---------- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/.azure-pipelines/client.yml b/.azure-pipelines/client.yml index 4023b841b199..505a6dc82a5f 100644 --- a/.azure-pipelines/client.yml +++ b/.azure-pipelines/client.yml @@ -25,6 +25,8 @@ jobs: inputs: command: pack packagesToPack: '$(ProjectFile)' + verbosityPack: normal + arguments: /warnaserror env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1 diff --git a/eng/Directory.Build.Data.props b/eng/Directory.Build.Data.props index f8a3bb65fa75..c0ff2c3726e9 100644 --- a/eng/Directory.Build.Data.props +++ b/eng/Directory.Build.Data.props @@ -5,6 +5,11 @@ AnyCPU $(Platform) latest + + $(NoWarn);NU5105 true true snupkg diff --git a/src/SDKs/KeyVault/data-plane/Microsoft.Azure.KeyVault.Tests/KeyVaultOperationsTest.cs b/src/SDKs/KeyVault/data-plane/Microsoft.Azure.KeyVault.Tests/KeyVaultOperationsTest.cs index 83f6ab49b228..38298ab555a9 100644 --- a/src/SDKs/KeyVault/data-plane/Microsoft.Azure.KeyVault.Tests/KeyVaultOperationsTest.cs +++ b/src/SDKs/KeyVault/data-plane/Microsoft.Azure.KeyVault.Tests/KeyVaultOperationsTest.cs @@ -402,7 +402,7 @@ private static void TestSignVerify(KeyVaultClient client, KeyBundle keyBundle, i Assert.False(verified); #endif } - +/* public void CreateGetDeleteKeyTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -457,7 +457,7 @@ public void CreateGetDeleteKeyTest() Assert.True(recoveryLevelIsConsistent, "the 'recoveryLevel' attribute did not consistently return the expected value."); } } - +*/ [Fact] public void CreateHsmKeyTest() { @@ -764,7 +764,7 @@ public void SecretBackupRestoreTest() try { - // Backup the secret + // Backup the secret var backupResponse = client.BackupSecretAsync(_vaultAddress, name).GetAwaiter().GetResult(); client.DeleteSecretAsync(_vaultAddress, name).Wait(); @@ -967,7 +967,7 @@ public void GetDeletedKeyTest() Assert.True(recoveryLevelIsConsistent, "the 'recoveryLevel' attribute did not consistently return the expected value."); } } - +/* public void KeyCreateDeleteRecoverPurgeTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -1065,7 +1065,7 @@ public void KeyCreateDeleteRecoverPurgeTest() Assert.True(recoveryLevelIsConsistent, "the 'recoveryLevel' attribute did not consistently return the expected value."); } } - +*/ [Fact] public void ListDeletedKeysTest() { @@ -1156,7 +1156,7 @@ public void ListDeletedKeysTest() #endregion #region Secret Operations - +/* public void SecretCreateUpdateDeleteTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -1231,7 +1231,7 @@ public void SecretCreateUpdateDeleteTest() } } } - +*/ [Fact] public void GetSecretVersionTest() { @@ -1542,7 +1542,7 @@ public void GetDeletedSecretTest() Assert.True(recoveryLevelIsConsistent, "the 'recoveryLevel' attribute did not consistently return the expected value."); } } - +/* public void SecretCreateDeleteRecoverPurgeTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -1643,7 +1643,7 @@ public void SecretCreateDeleteRecoverPurgeTest() Assert.True(recoveryLevelAttributeIsConsistent, "The 'recoveryLevel' attribute did not consistently return the expected value"); } } - +*/ [Fact] public void ListDeletedSecretsTest() { @@ -2421,7 +2421,7 @@ public void CertificateCreateLongSelfSignedTest() Assert.True(0 == string.CompareOrdinal(retrievedCertificate.SubjectName.Name, certificateSubjectName)); Assert.True(0 == string.CompareOrdinal(retrievedCertificate.IssuerName.Name, certificateSubjectName)); - // 24 months (ie 2 years) is 729 or 730 days. + // 24 months (ie 2 years) is 729 or 730 days. // for some reason the validity is 731 (+ some) days though var validity = retrievedCertificate.NotAfter - retrievedCertificate.NotBefore; Assert.True(validity >= TimeSpan.FromDays(729)); @@ -2512,7 +2512,7 @@ public void CertificateCreateTestIssuerTest() Assert.True(0 == string.CompareOrdinal(retrievedCertificate.SubjectName.Name, certificateSubjectName)); Assert.True(0 == string.CompareOrdinal(retrievedCertificate.IssuerName.Name, certificateSubjectName)); - // 24 months (ie 2 years) is 729 or 730 days. + // 24 months (ie 2 years) is 729 or 730 days. // for some reason the validity is 731 (+ some) days though var validity = retrievedCertificate.NotAfter - retrievedCertificate.NotBefore; Assert.True(validity >= TimeSpan.FromDays(729)); @@ -2601,7 +2601,7 @@ public void CertificateAsyncRequestCancellationTest() } } } - +/* public void CertificateAsyncDeleteOperationTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -2695,7 +2695,7 @@ public void CertificateAsyncDeleteOperationTest() } } } - +*/ [Fact] public void CertificateUpdateTest() { @@ -3151,7 +3151,7 @@ public void GetDeletedCertificateTest() policy).GetAwaiter().GetResult(); recoveryLevelIsConsistent &= VerifyDeletionRecoveryLevel(createdCertificateBundle.Attributes, _softDeleteEnabled); - // add another version + // add another version var attributes = new CertificateAttributes { Enabled = true, @@ -3201,7 +3201,7 @@ public void GetDeletedCertificateTest() Assert.True(recoveryLevelIsConsistent, "The 'recoveryLevel' attribute did not consistently return the expected value."); } } - +/* public void CertificateCreateDeleteRecoverPurgeTest() { using (MockContext context = MockContext.Start(this.GetType().FullName)) @@ -3328,7 +3328,7 @@ public void CertificateCreateDeleteRecoverPurgeTest() Assert.True(recoveryLevelIsConsistent, "The 'recoveryLevel' attribute did not consistently return the expected value"); } } - +*/ [Fact] public void ListDeletedCertificatesTest() { @@ -3649,7 +3649,7 @@ public void StorageRegenerateKeyTest() } } } - +/* public void StorageSasDefCreateTest() { using (MockContext.Start(this.GetType().FullName)) @@ -3834,7 +3834,7 @@ public void StorageSasDefListTest() } } } - +*/ #endregion #region Helper Methods @@ -3902,7 +3902,7 @@ private void WrapAndUnwrap(KeyVaultClient client, KeyIdentifier keyIdentifier, s /// /// key identifier /// sign algorithm - /// digest hash + /// digest hash private void SignVerify(KeyVaultClient client, KeyIdentifier keyIdentifier, string algorithm, byte[] digest) { var signResult = client.SignAsync(keyIdentifier.BaseIdentifier, algorithm, digest).GetAwaiter().GetResult(); @@ -4037,7 +4037,7 @@ private void VerifyTagsAreEqual(IDictionary expected, IDictionar /// Creates a key bundle from existing key material. /// /// Key type. - /// Key material or content description. + /// Key material or content description. /// Initial 'enabled' state. /// Key cannot be used before this time. /// Key cannot be used after this time. @@ -4050,7 +4050,7 @@ protected static KeyBundle GetImportKeyBundle(string keyType, byte[] keyToken = /// /// Creates a key bundle from an existing JSON web key. /// - /// The key to import. Must contain public and private components. + /// The key to import. Must contain public and private components. /// Initial 'enabled' state. /// Key cannot be used before this time. /// Key cannot be used after this time. @@ -4238,7 +4238,7 @@ private class HttpClientFactory /// An http client instance with the specified delegating handlers as the inner pipeline. /// /// * The original implementation of this class is in the System.Net.Http.Formatting assembly, which - /// does not support .netcoreApp as a target framework. + /// does not support .netcoreApp as a target framework. /// * Since the class is private, no parameter validation is required. However, the provider /// of the delegating handler array must behave, and ensure there are no preset inners. /// @@ -4246,7 +4246,7 @@ public static HttpClient Create(DelegatingHandler[] handlers) { for (int idx = 1; idx < handlers.Length; idx++) { - // set each previous handler as the inner of the subsequent one. + // set each previous handler as the inner of the subsequent one. // Last handler becomes the first handler in the pipeline. handlers[idx].InnerHandler = handlers[idx - 1]; } From cb07c6669c77e9f26cef1fa81e4079a23337541e Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Mon, 11 Mar 2019 09:31:14 -0700 Subject: [PATCH 2/2] Use script instead of DotNETCoreCLI task The DotNETCoreCLI task doesn't support extra arguments when calling the pack command so we need to directly call pack instead. see https://github.com/Microsoft/azure-pipelines-tasks/issues/9789 --- .azure-pipelines/client.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.azure-pipelines/client.yml b/.azure-pipelines/client.yml index 505a6dc82a5f..ff53bef3f444 100644 --- a/.azure-pipelines/client.yml +++ b/.azure-pipelines/client.yml @@ -20,13 +20,8 @@ jobs: inputs: version: '$(DotNetCoreVersion)' - - task: DotNetCoreCLI@2 + - script: 'dotnet pack $(ProjectFile) -o $(Build.ArtifactStagingDirectory) -warnaserror' displayName: 'Build and Package' - inputs: - command: pack - packagesToPack: '$(ProjectFile)' - verbosityPack: normal - arguments: /warnaserror env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1