-
-
Notifications
You must be signed in to change notification settings - Fork 313
Fix running e2e backend #2710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/e2e-backend
Are you sure you want to change the base?
Fix running e2e backend #2710
Changes from 10 commits
cafa25f
fd0aa86
9047b0b
1556873
f506341
c35e43f
a80f661
d2d8a58
a96185f
74bdb6c
9893384
3b4c9e2
f747481
ddae26b
95b1391
4d2e344
fd2219d
3ea8fc7
5e2c36c
d3f9aef
a1570cf
ddc7e32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,8 @@ def cache_response( | |
| def decorator(view_func): | ||
| @wraps(view_func) | ||
| def _wrapper(request, *args, **kwargs): | ||
| if settings.IS_E2E_ENVIRONMENT: | ||
|
||
| return view_func(request, *args, **kwargs) | ||
| if request.method not in ("GET", "HEAD"): | ||
| return view_func(request, *args, **kwargs) | ||
|
|
||
|
|
||
ahmedxgouda marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/bin/sh | ||
|
|
||
| export PGPASSWORD="$DJANGO_DB_PASSWORD" | ||
ahmedxgouda marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| export TEMP_DB="temp_$DJANGO_DB_NAME" | ||
|
|
||
| # 1. Create a temporary copy of the database | ||
| echo "Creating temporary database $TEMP_DB…" | ||
|
|
||
| psql -h "$DJANGO_DB_HOST" -U "$DJANGO_DB_USER" -d postgres -c \ | ||
| "CREATE DATABASE $TEMP_DB TEMPLATE $DJANGO_DB_NAME;" | ||
|
|
||
| # 2. Generate all UPDATE statements dynamically | ||
| UPDATES=$(psql -h "$DJANGO_DB_HOST" -U "$DJANGO_DB_USER" -d "$TEMP_DB" -Atqc " | ||
| SELECT 'UPDATE ' | ||
| || quote_ident(n.nspname) || '.' || quote_ident(c.relname) | ||
| || ' SET ' || quote_ident(a.attname) | ||
| || ' = '''';' | ||
| FROM pg_attribute a | ||
| JOIN pg_class c ON c.oid = a.attrelid | ||
| JOIN pg_namespace n ON n.oid = c.relnamespace | ||
| WHERE a.attname = 'email' | ||
| AND a.attnum > 0 | ||
| AND NOT a.attisdropped | ||
| AND n.nspname NOT IN ('pg_catalog','information_schema'); | ||
| ") | ||
|
|
||
| echo "Hiding email addresses…" | ||
| echo "$UPDATES" | psql -h "$DJANGO_DB_HOST" -U "$DJANGO_DB_USER" -d "$TEMP_DB" | ||
|
|
||
| # 3. Dump the DB | ||
| echo "Creating dump…" | ||
| pg_dump -h "$DJANGO_DB_HOST" -U "$DJANGO_DB_USER" -d "$TEMP_DB" | gzip -9 > ./data/nest.sql.gz | ||
ahmedxgouda marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # 4. Drop the temporary database | ||
| echo "Dropping temporary database $TEMP_DB…" | ||
| psql -h "$DJANGO_DB_HOST" -U "$DJANGO_DB_USER" -d postgres -c "DROP DATABASE $TEMP_DB;" | ||
|
|
||
| echo "Dump created: data/nest.sql.gz" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.