Skip to content

Commit

Permalink
Fixed mysql integration tests for #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaakko Heusala committed Sep 8, 2024
1 parent 9011c36 commit b905ef7
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 16 deletions.
16 changes: 16 additions & 0 deletions scripts/is-docker-container-running.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
cd "$(dirname "$0")/.."
set -e

CONTAINER_NAME_OR_ID="$1"
if test "x$CONTAINER_NAME_OR_ID" = x; then
echo 'USAGE: ./scripts/is-docker-container-running.sh NAME' >&2
exit 2
fi

# Check if the container is running
if [ "$(docker ps -q -f name="$CONTAINER_NAME_OR_ID")" ]; then
exit 0
else
exit 1
fi
3 changes: 2 additions & 1 deletion scripts/reset-integration-test-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

docker run -i --rm mysql:8 mysql -uhg -hhost.docker.internal -prxPe4XHbonLeHwjvKdq9R9aDWf1xiUje hg < ./src/fi/hg/mysql/docker/initial.sql
docker run -i --rm mysql:8 mysql -uhg -hhost.docker.internal -prxPe4XHbonLeHwjvKdq9R9aDWf1xiUje hg < ./src/io/hyperify/mysql/docker/initial.sql
3 changes: 2 additions & 1 deletion scripts/reset-integration-test-pg.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

docker run -i --rm postgres:15 psql 'postgresql://hg:rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje@host.docker.internal/hg' < ./src/fi/hg/pg/docker/initial.sql
docker run -i --rm postgres:15 psql 'postgresql://hg:rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje@host.docker.internal/hg' < ./src/io/hyperify/pg/docker/initial.sql
1 change: 1 addition & 0 deletions scripts/run-all-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
cd "$(dirname "$0")/.."
set -e
set -x

Expand Down
3 changes: 2 additions & 1 deletion scripts/run-integration-test-memory.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

npm run clear
TEST_SCOPES=integration,hg npm run test:ci -- 'MemoryRepositoryIntegration.test.ts' "$@"
TEST_SCOPES=integration,unit npm run test:ci -- 'MemoryRepositoryIntegration.test.ts' "$@"
23 changes: 21 additions & 2 deletions scripts/run-integration-test-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -x
set -e

if ./scripts/is-docker-container-running.sh io-hyperify-mysql-server; then
echo 'Test server was already running' >&2
exit 2
fi

set -x
npm run clear
TEST_MYSQL_PASSWORD='rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje' TEST_SCOPES=integration,hg npm run test:ci -- "$@" MySqlRepositoryIntegration.test.ts
./scripts/start-integration-test-server-mysql.sh

cleanup() {
if ./scripts/is-docker-container-running.sh io-hyperify-mysql-server; then
./scripts/stop-integration-test-server-mysql.sh
fi
}
trap cleanup EXIT

./scripts/reset-integration-test-mysql.sh
TEST_MYSQL_PASSWORD='rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje' TEST_SCOPES=integration,unit npm run test:ci -- "$@" MySqlRepositoryIntegration.test.ts
if ./scripts/is-docker-container-running.sh io-hyperify-mysql-server; then
./scripts/stop-integration-test-server-mysql.sh
fi
13 changes: 11 additions & 2 deletions scripts/run-integration-test-pg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -x
set -e

if ./is-docker-container-running.sh io-hyperify-pg-server; then
echo 'Test server was already running' >&2
exit 2
fi

set -x
npm run clear
TEST_POSTGRES_PASSWORD='rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje' TEST_SCOPES=integration,hg npm run test:ci -- "$@" 'PgRepositoryIntegration.test.ts'
./scripts/start-integration-test-server-pg.sh
./scripts/reset-integration-test-pg.sh
TEST_POSTGRES_PASSWORD='rxPe4XHbonLeHwjvKdq9R9aDWf1xiUje' TEST_SCOPES=integration,unit npm run test:ci -- "$@" 'PgRepositoryIntegration.test.ts'
./scripts/stop-integration-test-server-pg.sh
6 changes: 4 additions & 2 deletions scripts/start-integration-test-server-mysql.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

cd src/fi/hg/mysql/docker/
docker-compose up --build
cd src/io/hyperify/mysql/docker/
docker-compose up -d --build
sleep 10
6 changes: 4 additions & 2 deletions scripts/start-integration-test-server-pg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

cd src/fi/hg/pg/docker/
docker-compose up --build
cd src/io/hyperify/pg/docker/
docker-compose up -d --build
sleep 3
7 changes: 7 additions & 0 deletions scripts/stop-integration-test-server-mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

cd src/io/hyperify/mysql/docker/
exec docker-compose down
7 changes: 7 additions & 0 deletions scripts/stop-integration-test-server-pg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
cd "$(dirname "$0")/.."
set -e
set -x

cd src/io/hyperify/pg/docker/
exec docker-compose down
2 changes: 1 addition & 1 deletion src/io/hyperify/core
Submodule core updated 83 files
+18 −1 CurrencyUtils.ts
+13 −0 EmailAuthHttpService.ts
+11 −2 Json.ts
+11 −11 README.md
+11 −0 StringUtils.ts
+19 −7 auth/email/types/AuthenticateEmailDTO.ts
+2 −2 auth/email/types/EmailTokenDTO.ts
+1 −1 com/joker/dmapi/FiHgComJokerDomainManagementAPI.ts
+9 −9 data/README.md
+6 −6 discord/discord/README.md
+2 −2 discord/discord/tsconfig.json
+1 −1 entities/component/ComponentContent.ts
+13 −2 facebook/FacebookGraphClient.ts
+4 −3 facebook/FacebookGraphClientImpl.test.ts
+43 −8 facebook/FacebookGraphClientImpl.ts
+2 −0 facebook/facebook-constants.ts
+95 −0 facebook/types/FacebookAccessTokenDTO.ts
+18 −6 facebook/types/FacebookAccountListDTO.ts
+94 −0 facebook/types/FacebookAdAccountDTO.ts
+90 −0 facebook/types/FacebookAdAccountListDTO.ts
+257 −0 facebook/types/FacebookAdCampaignDTO.ts
+45 −0 facebook/types/FacebookBidStrategy.ts
+82 −0 facebook/types/FacebookCursorsDTO.ts
+101 −0 facebook/types/FacebookPageCategory.ts
+23 −36 facebook/types/FacebookPageDTO.ts
+83 −0 facebook/types/FacebookPagingDTO.ts
+2 −0 facebook/types/FacebookScope.ts
+20 −0 functions/prefixLines.ts
+4 −4 functions/replaceAll.ts
+6 −6 matrix/README.md
+35 −0 maventa/MaventaService.ts
+56 −0 maventa/MaventaServiceImpl.system.test.ts
+242 −0 maventa/MaventaServiceImpl.ts
+5 −0 maventa/maventa-constants.ts
+103 −0 maventa/types/MaventaAction.ts
+108 −0 maventa/types/MaventaConfig.ts
+43 −0 maventa/types/MaventaDirection.ts
+101 −0 maventa/types/MaventaFile.ts
+209 −0 maventa/types/MaventaInvoice.ts
+103 −0 maventa/types/MaventaRecipient.ts
+52 −0 maventa/types/MaventaReturnFormat.ts
+49 −0 maventa/types/MaventaRevisionObject.ts
+96 −0 maventa/types/MaventaSender.ts
+21 −15 maventa/types/MaventaTokenResponse.ts
+29 −17 paytrail/HttpPaytrailClient.system.test.ts
+3 −3 request/README.md
+1 −1 simpleRepository/SimpleMemoryRepository.ts
+2 −2 simpleRepository/types/SimpleRepositoryType.ts
+27 −1 store/constants/storeTranslation.ts
+3 −1 store/types/api/StoreIndexDTO.ts
+89 −0 store/types/api/StoreInventoryStatisticsDTO.ts
+130 −0 store/types/api/StoreInventorySummaryDTO.ts
+91 −0 store/types/document/DocumentDTO.ts
+76 −0 store/types/document/NewDocumentDTO.ts
+13 −34 store/types/inventory/InventoryState.ts
+59 −26 store/types/product/NewProductDTO.ts
+65 −0 store/types/product/NewProductFeatureDTO.ts
+88 −0 store/types/product/NewProductGroupDTO.ts
+0 −0 store/types/product/NewProductPriceDTO.ts
+177 −52 store/types/product/Product.ts
+62 −29 store/types/product/ProductDTO.ts
+81 −0 store/types/product/ProductFeatureDTO.ts
+24 −14 store/types/product/ProductModel.ts
+73 −11 store/types/product/ProductPrice.ts
+13 −13 store/types/product/ProductPriceType.ts
+0 −1 store/types/product/ProductTableItemModel.ts
+4 −2 store/types/product/ProductType.ts
+43 −0 store/types/product/features/EmailOption.ts
+2 −1 store/types/product/features/OperatingSystem.ts
+55 −0 store/types/product/features/PHPVersion.ts
+50 −25 store/types/product/features/ProductFeature.ts
+8 −2 store/types/product/features/ProductFeatureCategory.ts
+70 −2 store/types/product/features/ProductFeatureId.ts
+45 −0 store/types/product/features/WebServer.ts
+163 −0 store/types/purchaseInvoice/NewPurchaseInvoiceDTO.ts
+192 −0 store/types/purchaseInvoice/PurchaseInvoiceDTO.ts
+0 −132 store/utils/ProductUtils.test.ts
+3 −56 store/utils/ProductUtils.ts
+9 −22 types/String.ts
+1 −1 types/explain.ts
+1 −1 whois/WhoisService.ts
+22 −6 wordpress/dto/WpPageDTO.ts
+22 −6 wordpress/dto/WpPostDTO.ts
2 changes: 1 addition & 1 deletion src/io/hyperify/mysql
2 changes: 1 addition & 1 deletion src/io/hyperify/node
2 changes: 1 addition & 1 deletion src/io/hyperify/pg
Submodule pg updated 2 files
+6 −6 README.md
+3 −3 docker/docker-compose.yml

0 comments on commit b905ef7

Please sign in to comment.