You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Emmanuel Bourg <eb...@apache.org> on 2016/11/17 12:25:52 UTC

Minor improvement for TestOpenSSLCipherConfigurationParser

Hi,

As I ran the Tomcat 8.5 APR tests on Debian I noticed several failures
in TestOpenSSLCipherConfigurationParser. They were caused by the missing
IDEA cipher which was historically disabled in Debian due to patent
issues, but that wasn't immediately obvious because the failure message
simply states that ciphers are missing but not which ones are missing.
The message looked like this:

    Testcase: testMEDIUM took 0.003 sec
            FAILED
    expected:<4> but was:<6>

I'd like to suggest this minor modification to improve the messages:

--- a/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java
+++ b/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java
@@ -562,8 +563,8 @@

         // First check the lists have the same entries
         // Order is NOT important at this point. It is checked below.
-        Assert.assertEquals(jsseCipherListFromOpenSSL.size(), jsseCipherListFromParser.size());
-        Assert.assertTrue(jsseCipherListFromOpenSSL.containsAll(jsseCipherListFromParser));
+        Assert.assertEquals("Expected " + jsseCipherListFromParser.size() + " ciphers but got " + jsseCipherListFromOpenSSL.size() + " for the specification '" + specification + "'",
+                            new TreeSet(jsseCipherListFromParser), new TreeSet(jsseCipherListFromOpenSSL));

         // OpenSSL treats many ciphers as having equal preference. The order
         // returned depends on the order they are requested. The following code

This will display something like this:

    Expected 6 ciphers but got 4 for the specification 'MEDIUM' 

followed by the sorted ciphers in both lists, such that they can
be easily compared.

Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Minor improvement for TestOpenSSLCipherConfigurationParser

Posted by Violeta Georgieva <mi...@gmail.com>.
Hi,

2016-11-17 14:25 GMT+02:00 Emmanuel Bourg <eb...@apache.org>:
>
> Hi,
>
> As I ran the Tomcat 8.5 APR tests on Debian I noticed several failures
> in TestOpenSSLCipherConfigurationParser. They were caused by the missing
> IDEA cipher which was historically disabled in Debian due to patent
> issues, but that wasn't immediately obvious because the failure message
> simply states that ciphers are missing but not which ones are missing.
> The message looked like this:
>
>     Testcase: testMEDIUM took 0.003 sec
>             FAILED
>     expected:<4> but was:<6>
>
> I'd like to suggest this minor modification to improve the messages:
>
> ---
a/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java
> +++
b/test/org/apache/tomcat/util/net/openssl/ciphers/TestOpenSSLCipherConfigurationParser.java
> @@ -562,8 +563,8 @@
>
>          // First check the lists have the same entries
>          // Order is NOT important at this point. It is checked below.
> -        Assert.assertEquals(jsseCipherListFromOpenSSL.size(),
jsseCipherListFromParser.size());
> -
 Assert.assertTrue(jsseCipherListFromOpenSSL.containsAll(jsseCipherListFromParser));
> +        Assert.assertEquals("Expected " +
jsseCipherListFromParser.size() + " ciphers but got " +
jsseCipherListFromOpenSSL.size() + " for the specification '" +
specification + "'",
> +                            new TreeSet(jsseCipherListFromParser), new
TreeSet(jsseCipherListFromOpenSSL));
>
>          // OpenSSL treats many ciphers as having equal preference. The
order
>          // returned depends on the order they are requested. The
following code
>
> This will display something like this:
>
>     Expected 6 ciphers but got 4 for the specification 'MEDIUM'
>
> followed by the sorted ciphers in both lists, such that they can
> be easily compared.

Thanks for the report and the patch.
This has been fixed in
- 9.0.x for 9.0.0.M14 onwards and
- 8.5.x for 8.5.9 onwards

Regard,
Violeta

> Emmanuel Bourg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>