Cleanup Makefile targets, script names, and README

This commit is contained in:
Rob Kiefer 2017-01-12 14:51:40 -05:00
parent e419dbe621
commit 0ec5095cf5
4 changed files with 46 additions and 28 deletions

View File

@ -1,20 +1,28 @@
TEST_IMAGE_NAME = iobeamdb-test
TEST_CONTAINER_NAME = iobeamdb-test-container
IMAGE_NAME = iobeamdb
MAKE = make
all: test
all: test-docker
build-test-docker:
@docker build . -t $(TEST_IMAGE_NAME)
# Targets for installing the extension without using Docker
clean:
$(MAKE) -C ./extension clean
@rm -f ./extension/iobeamdb--*.sql
start-test-docker: stop-test-docker
@IOBEAMDB_DOCKER_IMAGE=$(TEST_IMAGE_NAME) ./scripts/start-pg-docker.sh
install:
$(MAKE) -C ./extension install
stop-test-docker:
# Targets for building/running Docker images
build-docker:
@docker build . -t $(IMAGE_NAME)
start-docker: stop-docker
@IOBEAMDB_DOCKER_IMAGE=$(IMAGE_NAME) ./scripts/start-docker.sh
stop-docker:
@docker rm -f iobeamdb || :
# Targets for tests
test-regression:
@cd extension/sql/tests/regression; ./run.sh
@ -24,9 +32,10 @@ test-unit:
test-all: test-regression test-unit
@echo Running all tests
test-docker: build-docker start-docker test-all stop-docker
# Setting up a single node database
setup-single-node-db:
PGDATABASE=test ./scripts/run_sql.sh setup_single_node_db.psql
PGDATABASE=test ./scripts/run_sql.sh setup_single_node_db.psql
test: build-test-docker start-test-docker test-all stop-test-docker
.PHONY: build-test-docker start-test-docker stop-test-docker test-regression test-unit test-all test all setup-single-node-db
.PHONY: build-docker start-docker stop-docker test-regression test-unit test-all test all setup-single-node-db

View File

@ -1,21 +1,26 @@
### Running docker image
### Building and running in Docker
To start the database, simply:
The `Makefile` included in this repo has convenient commands for building,
starting, and stopping a Docker image of **iobeamdb**:
```bash
make start-pg-docker
```
This will allow you to run the tests. When finished,
```bash
make stop-pg-docker
# To build the image
make build-docker
# To start the image (will stop any running instances first)
make start-docker
# To stop the image
make stop-docker
```
### Initializing a single-node database
After setting up a docker image, you can start a local
single node database with the following command:
With the Docker image running you can run the tests (see Testing) or create
your own single-node cluster.
#### Initializing a single-node database
After starting the Docker image, you can start a local single node database:
```bash
make setup-single-node-db
```
This will set up a database named iobeam which can be accessed with:
This will set up a database named `iobeam` which can be accessed with:
```bash
psql -U postgres -h localhost -d iobeam
```
@ -27,10 +32,14 @@ psql -U postgres -h localhost -d iobeam
* [Querying With Ioql](extension/sql/tests/regression/query.sql)
### Testing
There are three commands to run tests: (1) all tests, (2) regression tests, and
(3) unit tests. They are:
There are four commands to run tests:
```bash
make test
# Build and run a docker image and run all tests in that image
make test-docker
# Run all tests (no image built)
make test-all
# Run regression tests (no image built)
make test-regression
# Run unit tests (no image built)
make test-unit
```

View File

@ -35,4 +35,4 @@ package: clean all generate-sql-install-file
$(install_sh) -m 644 iobeamdb.control 'package/extension/'
$(install_sh) -m 644 iobeamdb--1.0.sql 'package/extension/'
.PHONY: check-sql-files generate-sql-install-file start-pg-docker stop-pg-docker test test-regression test-unit
.PHONY: check-sql-files generate-sql-install-file