1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 08:04:03 +00:00

Cache prefixing logic rewrite, session scoping improvements, tests refactor (#43)

* Run cache tests on all supported drivers

* update ci healthcheck for memcached

* remove memcached healthcheck

* fix typos in test comments, expand internal.md [ci skip]

* add empty line [ci skip]

* switch to using $store->setPrefix()

* add dynamodb

* refactor try-finally to try-catch

* remove unnecessary clearResolvedInstances() call

* add dual Cache:: and cache() assertions

* add apc

* Flush APCu cache in test setup

* Revert "add dual Cache:: and cache() assertions"

This reverts commit a0bab162fbe2dd0d25e7056ceca4fb7ce54efc77.

* phpstan fix

* Add logic for scoping 'file' disks to FilesystemTenancyBootstrapper

* minor changes, add todos

* refactor how the session.connection is used in the DB session bootstrapper

* add session forgery prevention logic to the db session bootstrapper

* only use the fs bootstrapper for file disk in 'cache data is separated' dataset

* minor session scoping test changes

* Add session scoping logic to FilesystemTenancyBootstrapper, correctly update disk roots even with storage_path_tenancy disabled

* Fix code style (php-cs-fixer)

* update docblock

* make not-null check more explicit

* separate bootstrapper tests, fix swapped test names for two tests

* refactor cache bootstrapper tests

* resolve global cache todo

* expand tests: session separation tests, more filesystem separation assertions; change prefix_base-type config keys to templates/formats

* add apc session scoping test, various session separation bugfixes

* phpstan + minor logic fixes

* prefix_format -> prefix

* fix database session separation test

* revert composer.json changes, update laravel dependencies to expected next release

* only run session scoping logic in cache bootstrapper for redis, memcached, dynamodb, apc; update gitattributes

* tenancy.central_domains -> tenancy.identification.central_domains

* db session separation test: add datasets

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
Samuel Štancl 2024-04-09 20:40:27 +02:00 committed by GitHub
parent 943b960718
commit eecf6f21c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 1856 additions and 1177 deletions

View file

@ -8,12 +8,18 @@ services:
depends_on:
mysql:
condition: service_healthy
mysql2:
condition: service_healthy
postgres:
condition: service_healthy
redis:
condition: service_healthy
# mssql:
# condition: service_healthy
mssql:
condition: service_healthy
memcached:
condition: service_healthy
dynamodb:
condition: service_healthy
volumes:
- .:/var/www/html:delegated
environment:
@ -68,22 +74,34 @@ services:
retries: 5
tmpfs:
- /var/lib/postgresql/data
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=P@ssword # todo reuse env from above
healthcheck: # https://github.com/Microsoft/mssql-docker/issues/133#issuecomment-1995615432
test: timeout 1 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/1433'
interval: 10s
timeout: 10s
retries: 10
redis:
image: redis:alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 1s
timeout: 3s
retries: 30
mssql:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- 1433:1433
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=P@ssword # todo reuse values from env above
retries: 20
memcached:
image: memcached:alpine
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P P@ssword -Q "SELECT 1" -b -o /dev/null
interval: 10s
timeout: 10s
retries: 10
test: ["CMD-SHELL", "echo version | nc localhost 11211 | grep -q VERSION"]
interval: 1s
timeout: 3s
retries: 20
dynamodb:
image: amazon/dynamodb-local:latest
healthcheck:
test: ["CMD-SHELL", "cat < /dev/null > /dev/tcp/127.0.0.1/8000"]
interval: 1s
timeout: 3s
retries: 20