Created
February 12, 2019 07:34
-
-
Save davidemoro/86fe29a67963751cbec95ed7fc30c561 to your computer and use it in GitHub Desktop.
Travis cassandra service setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo: required | |
services: | |
- cassandra | |
before_script: | |
- bash travis/setup_cassandra.sh | |
script: | |
- ... run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function cassandra_ready() { | |
count=0 | |
while ! cqlsh -e "describe cluster;" 2>&1 ; do | |
echo "waiting for cassandra" | |
if [ $count -gt 30 ] | |
then | |
exit | |
fi | |
(( count += 1 )) | |
sleep 1 | |
done | |
echo "cassandra is ready" | |
} | |
cassandra_ready | |
cqlsh -e "create keyspace dev with replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; USE dev; create table play(code int primary key, title varchar); insert into play (code, title) values (1, 'hello!');" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- provider: play_cassandra | |
type: execute | |
connection: | |
contact_points: | |
- 127.0.0.1 | |
port: 9042 | |
auth_provider: | |
username: cassandra | |
password: cassandra | |
keyspace: dev | |
query: SELECT title from play WHERE code = 1; | |
variable: title | |
variable_expression: results[0].title | |
assertion: "'$title' == 'hello!'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment