Skip to content

Commit

Permalink
[misc] SLL testing correction for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Sep 2, 2015
1 parent 0e0b935 commit 0b11f8e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .travis/before_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ set -e

export MYSQ_GPG_KEY=5072E1F5

#add JCE
if [ "x$TRAVIS_JDK_VERSION" == "xoraclejdk7" ]
then
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-unlimited-jce-policy

else if [ "x$TRAVIS_JDK_VERSION" == "xoraclejdk8" ]
then
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-unlimited-jce-policy
fi
fi

remove_mysql(){
sudo service mysql stop
sudo apt-get remove --purge mysql-server mysql-client mysql-common
Expand Down Expand Up @@ -67,6 +82,12 @@ sudo service mysql stop
sudo rm -f /var/lib/mysql/ib_logfile*
sudo service mysql start

#Adding sleep time if mysql DB. If not SSL not totally initialized when launching tests
if [ "x$MYSQL_VERSION" != "x" ]
then
sleep 10
fi

cat /etc/mysql/my.cnf

sudo mysql -uroot -e "create database IF NOT EXISTS test"
2 changes: 2 additions & 0 deletions src/test/java/org/mariadb/jdbc/DriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,8 @@ public void unsignedTest() throws Exception {
@Test
public void useSSL() throws Exception {
Assume.assumeTrue(haveSSL());
//Skip SSL test on java 7 since SSL packet size JDK-6521495).
org.junit.Assume.assumeFalse(System.getProperty("java.version").contains("1.7."));
setConnection("&useSSL=true&trustServerCertificate=true");
connection.createStatement().execute("select 1");
}
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/org/mariadb/jdbc/SSLValidationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public class SSLValidationTest extends BaseTest {
@Before
public void checkSSL() throws SQLException{
super.before();
org.junit.Assume.assumeTrue(haveSSL());
boolean isJava7 = System.getProperty("java.version").contains("1.7.");
org.junit.Assume.assumeTrue(haveSSL());
//Skip SSL test on java 7 since SSL packet size JDK-6521495).
org.junit.Assume.assumeFalse(isJava7);
ResultSet rs = connection.createStatement().executeQuery("select @@ssl_cert");
rs.next();
serverCertificatePath = rs.getString(1);
Expand Down

0 comments on commit 0b11f8e

Please sign in to comment.