forked from baron/baron-sso
chore: snapshot local state before dev merge
This commit is contained in:
@@ -23,10 +23,41 @@ assert_not_contains() {
|
||||
fi
|
||||
}
|
||||
|
||||
assert_service_contains() {
|
||||
local service="$1"
|
||||
local pattern="$2"
|
||||
awk -v service=" $service:" '
|
||||
$0 == service { in_service = 1; next }
|
||||
in_service && /^ [[:alnum:]_-]+:/ { in_service = 0 }
|
||||
in_service { print }
|
||||
' "$COMPOSE_FILE" | grep -Fq -- "$pattern" || fail "$service service must contain: $pattern"
|
||||
}
|
||||
|
||||
assert_service_not_contains() {
|
||||
local service="$1"
|
||||
local pattern="$2"
|
||||
if awk -v service=" $service:" '
|
||||
$0 == service { in_service = 1; next }
|
||||
in_service && /^ [[:alnum:]_-]+:/ { in_service = 0 }
|
||||
in_service { print }
|
||||
' "$COMPOSE_FILE" | grep -Fq -- "$pattern"; then
|
||||
fail "$service service must not contain: $pattern"
|
||||
fi
|
||||
}
|
||||
|
||||
for app in adminfront devfront orgfront; do
|
||||
assert_contains "./$app:/workspace/$app"
|
||||
assert_contains "/workspace/$app/node_modules"
|
||||
assert_not_contains "./$app:/app"
|
||||
assert_service_contains "$app" "target: dev"
|
||||
assert_service_contains "$app" "working_dir: /workspace/$app"
|
||||
assert_service_contains "$app" 'command: ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port",'
|
||||
assert_service_contains "$app" 'DEV_SERVER_WATCH_POLLING=${DEV_SERVER_WATCH_POLLING:-true}'
|
||||
assert_service_not_contains "$app" "serve_frontend_prod.mjs"
|
||||
grep -Fq -- "FROM deps AS dev" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must define a deps-based dev target"
|
||||
grep -Fq -- 'CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port",' "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile dev target must run Vite dev server"
|
||||
grep -Fq -- "FROM deps AS build" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must keep production build separate from dev"
|
||||
grep -Fq -- "FROM node:24-alpine AS production" "$ROOT_DIR/$app/Dockerfile" || fail "$app Dockerfile must keep production static serving target"
|
||||
done
|
||||
|
||||
assert_contains 'target: ${USERFRONT_BUILD_TARGET:-dev}'
|
||||
|
||||
34
test/gpd_level_order_policy_test.sh
Normal file
34
test/gpd_level_order_policy_test.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
csv_path="$repo_root/gpd_level.csv"
|
||||
|
||||
fail() {
|
||||
echo "ERROR: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -f "$csv_path" ] || fail "gpd_level.csv must exist"
|
||||
|
||||
line_of() {
|
||||
local name="$1"
|
||||
local line
|
||||
line="$(awk -F, -v name="\"${name}\"" '$1 == name { print NR; exit }' "$csv_path")"
|
||||
[ -n "$line" ] || fail "gpd_level.csv must contain ${name}"
|
||||
printf '%s\n' "$line"
|
||||
}
|
||||
|
||||
vice_president_line="$(line_of "부사장")"
|
||||
executive_director_line="$(line_of "전무이사")"
|
||||
principal_researcher_line="$(line_of "수석 연구원")"
|
||||
|
||||
[ "$vice_president_line" -lt "$executive_director_line" ] || \
|
||||
fail "전무이사 must be below 부사장 in GPDTDC level order"
|
||||
[ "$executive_director_line" -lt "$principal_researcher_line" ] || \
|
||||
fail "전무이사 must be above 수석 연구원 in GPDTDC level order"
|
||||
|
||||
grep -Fxq '"전무이사","execdir"' "$csv_path" || \
|
||||
fail "전무이사 external key must be execdir"
|
||||
|
||||
echo "OK: GPDTDC level order includes 전무이사 between 부사장 and 수석 연구원"
|
||||
51
test/playwright_frontend_runtime_policy_test.sh
Normal file
51
test/playwright_frontend_runtime_policy_test.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
fail() {
|
||||
echo "ERROR: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
assert_contains() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
grep -Fq -- "$pattern" "$file" || fail "$file must contain: $pattern"
|
||||
}
|
||||
|
||||
assert_not_contains() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
if grep -Fq -- "$pattern" "$file"; then
|
||||
fail "$file must not contain: $pattern"
|
||||
fi
|
||||
}
|
||||
|
||||
admin_config="$ROOT_DIR/adminfront/playwright.config.ts"
|
||||
dev_config="$ROOT_DIR/devfront/playwright.config.ts"
|
||||
org_config="$ROOT_DIR/orgfront/playwright.config.ts"
|
||||
|
||||
for file in "$admin_config" "$dev_config" "$org_config"; do
|
||||
assert_contains "$file" 'process.env.CI === "true" || process.env.PLAYWRIGHT_USE_PREVIEW === "true"'
|
||||
assert_contains "$file" "usePreviewServer"
|
||||
done
|
||||
|
||||
assert_contains "$admin_config" 'process.env.PORT ?? "5173"'
|
||||
assert_contains "$admin_config" 'pnpm exec vite --host 127.0.0.1 --port ${port} --strictPort'
|
||||
assert_contains "$admin_config" 'pnpm exec vite preview --host 127.0.0.1 --port ${port} --strictPort'
|
||||
|
||||
assert_contains "$dev_config" 'process.env.PORT ?? "5174"'
|
||||
assert_contains "$dev_config" 'process.env.PLAYWRIGHT_BASE_URL || process.env.BASE_URL'
|
||||
assert_contains "$dev_config" '|| defaultBaseUrl'
|
||||
assert_contains "$dev_config" './node_modules/.bin/vite --host 127.0.0.1 --strictPort --port ${port}'
|
||||
assert_contains "$dev_config" './node_modules/.bin/vite preview --host 127.0.0.1 --strictPort --port ${port}'
|
||||
assert_not_contains "$dev_config" "http://127.0.0.1:4174"
|
||||
assert_not_contains "$dev_config" "--port 4174"
|
||||
|
||||
assert_contains "$org_config" 'process.env.PORT ?? "5175"'
|
||||
assert_contains "$org_config" 'npm run dev -- --host 127.0.0.1 --port ${port}'
|
||||
assert_contains "$org_config" 'npm run preview -- --host 127.0.0.1 --port ${port}'
|
||||
assert_not_contains "$org_config" 'process.env.PORT ?? "4175"'
|
||||
|
||||
echo "OK: local Playwright uses Vite dev servers and CI/preview mode uses dist preview"
|
||||
Reference in New Issue
Block a user