mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
refactor: Update environment variable setup in test-setup.sh
This code change updates the environment variable setup in the test-setup.sh script. The sed command is used to modify the config.env file, setting the NODE_ENV to 'test' and BILLING_ENABLED to 'true'. Additionally, the DATABASE_HOST is set to 'localhost', DATABASE_PORT to '5400', REDIS_HOST to 'localhost', REDIS_PORT to '6379', REDIS_DB to '0', and REDIS_USERNAME to 'default'. This improvement ensures that the test environment is properly configured with the correct values for testing.
This commit is contained in:
parent
bc205a8686
commit
366b195152
@ -116,8 +116,6 @@ describe('TeamMemberService', () => {
|
||||
|
||||
describe('onBeforeCreate', () => {
|
||||
it('should throw exception if the user limit for a project is reached', async () => {
|
||||
process.env['BILLING_ENABLED'] = 'true';
|
||||
|
||||
const SEATS_LIMIT: number = 5;
|
||||
|
||||
ProjectService.findOneById = jest.fn().mockResolvedValue({
|
||||
|
@ -1,13 +1,5 @@
|
||||
import '../../Utils/Environment';
|
||||
|
||||
// Env vars are actually changed in CommonServer/test-setup.sh
|
||||
|
||||
process.env['NODE_ENV'] = 'test';
|
||||
|
||||
process.env['BILLING_ENABLED'] = 'true';
|
||||
|
||||
process.env['DATABASE_HOST'] = 'localhost';
|
||||
process.env['DATABASE_PORT'] = '5400';
|
||||
|
||||
process.env['REDIS_HOST'] = 'localhost';
|
||||
process.env['REDIS_PORT'] = '6379';
|
||||
process.env['REDIS_DB'] = '0';
|
||||
process.env['REDIS_USERNAME'] = 'default';
|
||||
|
@ -6,4 +6,30 @@ cd ..
|
||||
# Run Preinstall.
|
||||
npm run prerun
|
||||
# Run Postgres
|
||||
|
||||
# Change all of the following env vars in config.env
|
||||
|
||||
# process.env['NODE_ENV'] = 'test';
|
||||
|
||||
# process.env['BILLING_ENABLED'] = 'true';
|
||||
|
||||
# process.env['DATABASE_HOST'] = 'localhost';
|
||||
# process.env['DATABASE_PORT'] = '5400';
|
||||
|
||||
# process.env['REDIS_HOST'] = 'localhost';
|
||||
# process.env['REDIS_PORT'] = '6379';
|
||||
# process.env['REDIS_DB'] = '0';
|
||||
# process.env['REDIS_USERNAME'] = 'default';
|
||||
|
||||
# Using sed
|
||||
|
||||
sed -i 's/.*NODE_ENV.*/NODE_ENV=test/' config.env
|
||||
sed -i 's/.*BILLING_ENABLED.*/BILLING_ENABLED=true/' config.env
|
||||
sed -i 's/.*DATABASE_HOST.*/DATABASE_HOST=localhost/' config.env
|
||||
sed -i 's/.*DATABASE_PORT.*/DATABASE_PORT=5400/' config.env
|
||||
sed -i 's/.*REDIS_HOST.*/REDIS_HOST=localhost/' config.env
|
||||
sed -i 's/.*REDIS_PORT.*/REDIS_PORT=6379/' config.env
|
||||
sed -i 's/.*REDIS_DB.*/REDIS_DB=0/' config.env
|
||||
sed -i 's/.*REDIS_USERNAME.*/REDIS_USERNAME=default/' config.env
|
||||
|
||||
export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.dev.yml up -d postgres
|
Loading…
Reference in New Issue
Block a user