1
0
forked from baron/baron-sso
Files
baron-sso/test/gpd_level_order_policy_test.sh

35 lines
1.1 KiB
Bash

#!/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 수석 연구원"