Add cockroachdb smoke test
This commit is contained in:
56
script/test_cockroach.sh
Executable file
56
script/test_cockroach.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
function killproc() {
|
||||
lsof -i tcp:8888 | grep pgweb | awk '{print $2}' | uniq | xargs kill
|
||||
}
|
||||
|
||||
# Nuke the old container if exists.
|
||||
docker rm -f cockroach || true
|
||||
|
||||
# Start cockroach on 26258 so we dont mess with local server.
|
||||
docker run \
|
||||
--name=cockroach \
|
||||
-d \
|
||||
-t \
|
||||
-p 26258:26257 \
|
||||
cockroachdb/cockroach \
|
||||
start --insecure
|
||||
|
||||
sleep 3
|
||||
|
||||
# Load the demo database.
|
||||
docker exec -i cockroach ./cockroach sql --insecure < ./data/roach.sql
|
||||
|
||||
# Find and destroy the existing pgweb process.
|
||||
# Would be great if pgweb had --pid option.
|
||||
killproc
|
||||
|
||||
# Start pgweb and connect to cockroach.
|
||||
make build
|
||||
|
||||
./pgweb \
|
||||
--url=postgres://root@localhost:26258/roach?sslmode=disable \
|
||||
--listen=8888 \
|
||||
--skip-open &
|
||||
|
||||
sleep 1
|
||||
|
||||
# Run smoke tests
|
||||
base="-w \"\n\" -f http://localhost:8888/api"
|
||||
table="product_information"
|
||||
|
||||
curl $base/info
|
||||
curl $base/connection
|
||||
curl $base/schemas
|
||||
curl $base/objects
|
||||
curl $base/query -F query='select * from product_information;'
|
||||
curl $base/tables/$table
|
||||
curl $base/tables/$table/rows
|
||||
curl $base/tables/$table/info
|
||||
curl $base/tables/$table/indexes
|
||||
curl $base/tables/$table/constraints
|
||||
|
||||
# Cleanup
|
||||
killproc
|
||||
Reference in New Issue
Block a user