Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better assertions #1220

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void test_SSLSession_getCipherSuite() {

@Test
public void test_SSLSession_getCreationTime() {
// TODO(prb) seems to fail regularly on Windows with sTime <= t1
// TODO(prb) seems to fail regularly on Windows with sTime > t1
assumeFalse("Skipping SSLSession_getCreationTime() test on Windows", isWindows());

// We use OpenSSL, which only returns times accurate to the nearest second.
Expand Down
10 changes: 3 additions & 7 deletions openjdk/src/test/java/org/conscrypt/NativeCryptoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import static org.conscrypt.NativeConstants.TLS1_1_VERSION;
import static org.conscrypt.NativeConstants.TLS1_2_VERSION;
import static org.conscrypt.NativeConstants.TLS1_VERSION;
import static org.conscrypt.TestUtils.isWindows;
import static org.conscrypt.TestUtils.openTestFile;
import static org.conscrypt.TestUtils.readTestFile;
import static org.junit.Assert.assertEquals;
Expand All @@ -36,7 +35,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
import static org.mockito.ArgumentMatchers.same;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -853,7 +851,7 @@
// Create a NULL-terminated modified UTF-8 representation of pskIdentity.
byte[] b;
try {
b = pskIdentity.getBytes("UTF-8");

Check failure on line 854 in openjdk/src/test/java/org/conscrypt/NativeCryptoTest.java

View workflow job for this annotation

GitHub Actions / build (windows-latest)

warning: [StringCharset] StringCharset

Check failure on line 854 in openjdk/src/test/java/org/conscrypt/NativeCryptoTest.java

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

warning: [StringCharset] StringCharset
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 encoding not supported", e);
}
Expand Down Expand Up @@ -1394,7 +1392,7 @@
ServerHooks sHooks = new ServerHooks();
cHooks.pskEnabled = true;
sHooks.pskEnabled = true;
cHooks.pskKey = "1, 2, 3, 4, Testing...".getBytes("UTF-8");

Check failure on line 1395 in openjdk/src/test/java/org/conscrypt/NativeCryptoTest.java

View workflow job for this annotation

GitHub Actions / build (windows-latest)

warning: [StringCharset] StringCharset
sHooks.pskKey = cHooks.pskKey;
Future<TestSSLHandshakeCallbacks> client = handshake(listener, 0, true, cHooks, null, null);
Future<TestSSLHandshakeCallbacks> server =
Expand Down Expand Up @@ -2496,18 +2494,16 @@

@Test
public void test_SSL_SESSION_get_time() throws Exception {
// TODO(prb) seems to fail regularly on Windows with time < System.currentTimeMillis()
assumeFalse("Skipping SSLSession_getCreationTime() test on Windows", isWindows());

final ServerSocket listener = newServerSocket();
{
Hooks cHooks = new Hooks() {
@Override
public void afterHandshake(long session, long s, long c, Socket sock,
FileDescriptor fd, SSLHandshakeCallbacks callback) throws Exception {
long time = NativeCrypto.SSL_SESSION_get_time(session);
assertTrue(time != 0);
assertTrue(time < System.currentTimeMillis());
long now = System.currentTimeMillis();
assertTrue(time + " != 0", time != 0);
assertTrue(time + " <= " + now, time <= now);
super.afterHandshake(session, s, c, sock, fd, callback);
}
};
Expand Down
Loading