Skip to content

Commit

Permalink
Convert buildbot to Travis CI initial commit
Browse files Browse the repository at this point in the history
special-case security test for jRuby

Update to tools/ 1.0.3
  • Loading branch information
Luke Bakken committed Oct 21, 2016
1 parent cabd963 commit 2f1d088
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 76 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Expand Up @@ -17,12 +17,13 @@ env:
- RIAK_DOWNLOAD_URL=http://s3.amazonaws.com/downloads.basho.com/riak/2.0/2.0.7/ubuntu/trusty/riak_2.0.7-1_amd64.deb
- RIAK_DOWNLOAD_URL=http://s3.amazonaws.com/downloads.basho.com/riak/2.1/2.1.4/ubuntu/trusty/riak_2.1.4-1_amd64.deb
before_script:
- cp -vf ./spec/support/test_client.yml.example ./spec/support/test_client.yml
- sudo ./tools/travis-ci/riak-install -d "$RIAK_DOWNLOAD_URL"
- sudo ./tools/devrel/riak-cluster-config "$(which riak-admin)" 8098 false false
- sudo ./tools/setup-riak -s
script:
- bundle exec rubocop lib spec
- bundle exec rake spec spec:integration
- sudo riak-admin security disable
- make test
- sudo riak-admin security enable
- make security-test
notifications:
slack:
secure: nryEZNlLs0xpMJcrmTRzJIaFdfHWigsD4i9zEI8SgDdHqEgJ52/UfCifWHC7N4UckpRkmMUc8yt/Y4YS7G4Gu4yx4qXNIL33VmuudUe2YEVv+oVnG9oHVPkHDvOkRSLlWyAIqd4uXbLzghYBrHigoinfCcmjjRq5HNocRrvnwdE=
59 changes: 55 additions & 4 deletions Makefile
@@ -1,4 +1,6 @@
.PHONY: release gemspec_validate
.PHONY: help all deps lint clean
.PHONY: test unit-test integration-test security-test
.PHONY: release gemspec_validat0

unexport LANG
unexport LC_ADDRESS
Expand All @@ -14,13 +16,62 @@ unexport LC_PAPER
unexport LC_TELEPHONE
unexport LC_TIME

# NB:
# VERSION does NOT include the v suffix
PROJDIR = $(realpath $(CURDIR))
TCY := $(PROJDIR)/spec/support/test_client.yml
CLIENT_CERT := $(PROJDIR)/tools/test-ca/certs/riakuser-client-cert.pem
CA_CERT := $(PROJDIR)/tools/test-ca/certs/cacert.pem

help:
@echo ''
@echo ' Targets:'
@echo '-------------------------------------------------'
@echo ' all - Run everything '
@echo ' deps - Install required gems '
@echo ' lint - Run rubocop '
@echo ' clean - Clean local gems '
@echo ' test - Run unit & integration tests '
@echo ' unit-test - Run unit tests '
@echo ' integration-test - Run integration tests '
@echo ' security-test - Run security tests '
@echo '-------------------------------------------------'
@echo ''

all: test

deps: clean
@gem install bundler
@bundle install --binstubs --path=vendor --without=guard

lint:
@bundle exec rubocop lib spec

clean:
@rm -rf vendor/*
@rm -f Gemfile.lock

unit-test:
@bundle exec rake ci

integration-test:
@cp -f $(TCY).example $(TCY)
@bundle exec rake spec:integration

security-test:
@cp -f $(TCY).example $(TCY) && \
echo 'authentication:' >> $(TCY) && \
echo ' user: user' >> $(TCY) && \
echo ' password: password' >> $(TCY) && \
echo " ca_file: $(CA_CERT)" >> $(TCY)
@bundle exec rake spec:security

test: lint integration-test

gemspec_validate:
@rake gemspec
@bundle exec rake gemspec

release: gemspec_validate
# NB:
# VERSION does NOT include the v suffix
ifeq ($(VERSION),)
$(error VERSION must be set to build a release and deploy this package)
endif
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Expand Up @@ -75,6 +75,11 @@ namespace :spec do
RSpec::Core::RakeTask.new(:time_series) do |spec|
spec.rspec_opts = %w[--profile --tag time_series]
end

desc "Run Security Specs Only"
RSpec::Core::RakeTask.new(:security) do |spec|
spec.rspec_opts = %w[--profile --tag yes_security --tag ~time_series]
end
end

desc "Run Unit Test Specs (excluding slow, integration and time_series)"
Expand Down
61 changes: 0 additions & 61 deletions buildbot/Makefile

This file was deleted.

17 changes: 11 additions & 6 deletions spec/integration/riak/security_spec.rb
Expand Up @@ -51,9 +51,14 @@

bugged_crypto_client = Riak::Client.new broken_auth_config

expect{ bugged_crypto_client.ping }.
to(raise_error(OpenSSL::SSL::SSLError,
/certificate verify failed/i))
if RUBY_PLATFORM == 'java'
expect{ bugged_crypto_client.ping }.
to(raise_error(OpenSSL::SSL::SSLError))
else
expect{ bugged_crypto_client.ping }.
to(raise_error(OpenSSL::SSL::SSLError,
/certificate verify failed/i))
end
end

it "refuses to connect if the server cert is revoked" do
Expand Down Expand Up @@ -86,10 +91,10 @@

client_cert_config[:authentication][:client_ca] = client_cert_config[:authentication]['ca_file']

client_cert_config[:authentication][:cert] = 'spec/support/certs/client.crt'
client_cert_config[:authentication][:key] = 'spec/support/certs/client.key'
client_cert_config[:authentication][:cert] = 'tools/test-ca/certs/riakuser-client-cert.pem'
client_cert_config[:authentication][:key] = 'tools/test-ca/private/riakuser-client-cert-key.pem'

client_cert_config[:authentication][:user] = 'certuser'
client_cert_config[:authentication][:user] = 'riakuser'
client_cert_config[:authentication][:password] = ''

cert_client = Riak::Client.new client_cert_config
Expand Down

0 comments on commit 2f1d088

Please sign in to comment.