From 0ff6f16ec7b0e9cce8db7b8c57f42b55cbe9ff49 Mon Sep 17 00:00:00 2001 From: Karl Southern Date: Tue, 3 May 2016 17:09:21 +0100 Subject: [PATCH] Quick and dirty setup so it's a bit quicker to use vagrant. I'll clean this up more later. --- .travis.yml | 10 ++-------- README.md | 19 +++++++++++-------- Vagrantfile | 2 -- logstash-output-jdbc.gemspec | 2 +- scripts/travis-before_script.sh | 8 ++++++++ scripts/travis-variables.sh | 3 +++ 6 files changed, 25 insertions(+), 19 deletions(-) create mode 100755 scripts/travis-before_script.sh create mode 100644 scripts/travis-variables.sh diff --git a/.travis.yml b/.travis.yml index 5ae0779..53ada5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,6 @@ cache: bundler rvm: - jruby before_script: - - wget http://search.maven.org/remotecontent?filepath=org/apache/derby/derby/10.12.1.1/derby-10.12.1.1.jar -O /tmp/derby.jar - - export JDBC_DERBY_JAR=/tmp/derby.jar - - sudo apt-get install mysql-server -qq -y - - echo "create database logstash_output_jdbc_test;" | mysql -u root - - wget http://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar -O /tmp/mysql.jar - - export JDBC_MYSQL_JAR=/tmp/mysql.jar - - wget http://search.maven.org/remotecontent?filepath=org/xerial/sqlite-jdbc/3.8.11.2/sqlite-jdbc-3.8.11.2.jar -O /tmp/sqlite.jar - - export JDBC_SQLITE_JAR=/tmp/sqlite.jar + - ./scripts/travis-before_script.sh + - source ./scripts/travis-variables.sh script: bundle exec rspec diff --git a/README.md b/README.md index 3b5ed51..dd6afa8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ See CHANGELOG.md Released versions are available via rubygems, and typically tagged. For development: - - See master branch for logstash v5 + - See master branch for logstash v5 (currently **development only**) - See v2.x branch for logstash v2 - See v1.5 branch for logstash v1.5 - See v1.4 branch for logstash 1.4 @@ -36,14 +36,17 @@ For development: - And then configure (examples below) ## Running tests -At this time tests only run against Derby, in an in-memory database. -Acceptance tests for individual database engines will be added over time. +For development tests are recommended to run inside a virtual machine (Vagrantfile is included in the repo), as it requires +access to various database engines and could completely destroy any data in a live system. -Assuming valid jruby is installed - - First time, issue `jruby -S bundle install` to install dependencies - - Next, download Derby jar from https://db.apache.org/derby/ - - Run the tests `JDBC_DERBY_JAR=path/to/derby.jar jruby -S rspec` - - Optionally add the `JDBC_DEBUG=1` env variable to add logging to stdout +If you have vagrant available: + - `vagrant up` + - `vagrant ssh` + - `cd /vagrant` + - `gem install bundler` + - `cd /vagrant && bundle install` + - `./scripts/travis-before_script.sh && source ./scripts/travis-variables.sh` + - `bundle exec rspec` ## Configuration options diff --git a/Vagrantfile b/Vagrantfile index c04fa54..dc26e07 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -9,7 +9,5 @@ Vagrant.configure(2) do |config| gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby-1.7 usermod -a -G rvm vagrant - gem install bundler - cd /vagrant && bundle install EOP end diff --git a/logstash-output-jdbc.gemspec b/logstash-output-jdbc.gemspec index 78d47d9..28b5916 100644 --- a/logstash-output-jdbc.gemspec +++ b/logstash-output-jdbc.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |s| s.version = "1.0.0.pre" s.licenses = [ "Apache License (2.0)" ] s.summary = "This plugin allows you to output to SQL, via JDBC" - s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program" + s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install 'logstash-output-jdbc'. This gem is not a stand-alone program" s.authors = ["the_angry_angel"] s.email = "karl+github@theangryangel.co.uk" s.homepage = "https://github.com/theangryangel/logstash-output-jdbc" diff --git a/scripts/travis-before_script.sh b/scripts/travis-before_script.sh new file mode 100755 index 0000000..be0b752 --- /dev/null +++ b/scripts/travis-before_script.sh @@ -0,0 +1,8 @@ +#!/bin/bash +wget http://search.maven.org/remotecontent?filepath=org/apache/derby/derby/10.12.1.1/derby-10.12.1.1.jar -O /tmp/derby.jar + +sudo apt-get install mysql-server -qq -y +echo "create database logstash_output_jdbc_test;" | mysql -u root + +wget http://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar -O /tmp/mysql.jar +wget http://search.maven.org/remotecontent?filepath=org/xerial/sqlite-jdbc/3.8.11.2/sqlite-jdbc-3.8.11.2.jar -O /tmp/sqlite.jar diff --git a/scripts/travis-variables.sh b/scripts/travis-variables.sh new file mode 100644 index 0000000..5376629 --- /dev/null +++ b/scripts/travis-variables.sh @@ -0,0 +1,3 @@ +export JDBC_DERBY_JAR=/tmp/derby.jar +export JDBC_MYSQL_JAR=/tmp/mysql.jar +export JDBC_SQLITE_JAR=/tmp/sqlite.jar