Skip to content

Commit

Permalink
Merge pull request ledgersmb#8565 from ehuelsmann/tooling/create-stan…
Browse files Browse the repository at this point in the history
…dard-testdb

Add Makefile command to quickly create a test company
  • Loading branch information
ehuelsmann authored Jan 2, 2025
2 parents 90bb096 + 244f8a8 commit 8f39291
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Help on using this Makefile
- serve : Runs the 'webpack serve' command
- devtest : Runs all tests including development tests (TESTS='t/ xt/')
- jstest : Runs all UI tests (TESTS='UI/tests')
- testdb : Creates test database (TESTDB='test')
with user (TESTUSER='test')
and config (TESTCONF='locale/coa/us/General.xml')
- pherkin : Runs all BDD tests with 'pherkin' (instead of 'prove')

- blacklist : Builds sql blacklist (required after adding functions)
Expand Down Expand Up @@ -155,6 +158,12 @@ test: TESTS ?= t/
test:
$(DOCKER_CMD) yath test --no-color $(TEST_OPTS) $(TESTS)

testdb: TESTDB ?= test
testdb: TESTUSER ?= test
testdb: TESTCONF ?= locale/coa/us/General.xml
testdb:
$(DOCKER_CMD) bash -c "TESTUSER='$(TESTUSER)' utils/devel/create-test-db '${TESTDB}' '${TESTCONF}'"

devtest: TESTS ?= t/ xt/
devtest: PGTAP_OPTS ?= --pgtap-dbname=lsmb_test --pgtap-username=postgres \
--pgtap-psql=.circleci/psql-wrap
Expand Down
11 changes: 11 additions & 0 deletions utils/devel/create-test-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

TESTDB=$1
TESTCONFIG=$2

set -x

bin/ledgersmb-admin create postgres@${POSTGRES_HOST}/${TESTDB}#xyz
bin/ledgersmb-admin setup load postgres@${POSTGRES_HOST}/${TESTDB}#xyz $TESTCONFIG
bin/ledgersmb-admin user create postgres@${POSTGRES_HOST}/${TESTDB}#xyz --username ${TESTUSER:-test} --password abc --ssn 1 --country US --first-name T --last-name E --employeenumber 1 --permission "Full Permissions"

0 comments on commit 8f39291

Please sign in to comment.