Skip to content

Commit 4b2bd66

Browse files
update token gen script to run for all tokens needed
1 parent 0bb6979 commit 4b2bd66

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

examples/tokens/set_data_track_test_tokens.bash renamed to examples/tokens/set_integration_test_tokens.bash

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
# limitations under the License.
1515

1616
# Generate two LiveKit access tokens via `lk` and set the environment variables
17-
# required by src/tests/integration/test_data_track.cpp.
17+
# required by src/tests/integration/test_data_track.cpp and src/tests/integration/test_rpc.cpp.
1818
#
19-
# source examples/tokens/set_data_track_test_tokens.bash
20-
# eval "$(bash examples/tokens/set_data_track_test_tokens.bash)"
19+
# source examples/tokens/set_integration_test_tokens.bash
20+
# eval "$(bash examples/tokens/set_integration_test_tokens.bash)"
2121
#
2222
# Exports:
2323
# LK_TOKEN_TEST_A
@@ -33,7 +33,7 @@ elif [[ -n "${ZSH_VERSION:-}" ]] && [[ "${ZSH_EVAL_CONTEXT:-}" == *:file* ]]; th
3333
fi
3434

3535
_fail() {
36-
echo "set_data_track_test_tokens.bash: $1" >&2
36+
echo "set_integration_test_tokens.bash: $1" >&2
3737
if [[ "$_sourced" -eq 1 ]]; then
3838
return "${2:-1}"
3939
fi
@@ -44,10 +44,16 @@ if [[ "$_sourced" -eq 0 ]]; then
4444
set -euo pipefail
4545
fi
4646

47+
# data track
4748
LIVEKIT_ROOM="cpp_data_track_test"
4849
LIVEKIT_IDENTITY_A="cpp-test-a"
4950
LIVEKIT_IDENTITY_B="cpp-test-b"
5051

52+
# rpc
53+
LIVEKIT_RPC_ROOM="rpc-test-room"
54+
LIVEKIT_CALLER_TOKEN="caller"
55+
LIVEKIT_RECEIVER_TOKEN="receiver"
56+
5157
if [[ $# -ne 0 ]]; then
5258
_fail "this script is hard-coded and does not accept arguments" 2
5359
fi
@@ -104,23 +110,29 @@ _create_token() {
104110

105111
LK_TOKEN_TEST_A="$(_create_token "$LIVEKIT_IDENTITY_A")"
106112
LK_TOKEN_TEST_B="$(_create_token "$LIVEKIT_IDENTITY_B")"
113+
LK_TOKEN_RPC_CALLER="$(_create_token "$LIVEKIT_CALLER_TOKEN")"
114+
LK_TOKEN_RPC_RECEIVER="$(_create_token "$LIVEKIT_RECEIVER_TOKEN")"
107115

108116
_apply() {
109117
export LK_TOKEN_TEST_A
110118
export LK_TOKEN_TEST_B
119+
export LK_TOKEN_RPC_CALLER
120+
export LK_TOKEN_RPC_RECEIVER
111121
export LIVEKIT_URL
112122
}
113123

114124
_emit_eval() {
115125
printf 'export LK_TOKEN_TEST_A=%q\n' "$LK_TOKEN_TEST_A"
116126
printf 'export LK_TOKEN_TEST_B=%q\n' "$LK_TOKEN_TEST_B"
127+
printf 'export LK_TOKEN_RPC_CALLER=%q\n' "$LK_TOKEN_RPC_CALLER"
128+
printf 'export LK_TOKEN_RPC_RECEIVER=%q\n' "$LK_TOKEN_RPC_RECEIVER"
117129
printf 'export LIVEKIT_URL=%q\n' "$LIVEKIT_URL"
118130
}
119131

120132
if [[ "$_sourced" -eq 1 ]]; then
121133
_apply
122-
echo "LK_TOKEN_TEST_A, LK_TOKEN_TEST_B, and LIVEKIT_URL set for this shell." >&2
134+
echo "LK_TOKEN_TEST_A, LK_TOKEN_TEST_B, LK_TOKEN_RPC_CALLER, LK_TOKEN_RPC_RECEIVER, and LIVEKIT_URL set for this shell." >&2
123135
else
124136
_emit_eval
125-
echo "set_data_track_test_tokens.bash: for this shell run: source $0 or: eval \"\$(bash $0 ...)\"" >&2
137+
echo "set_integration_test_tokens.bash: for this shell run: source $0 or: eval \"\$(bash $0 ...)\"" >&2
126138
fi

0 commit comments

Comments
 (0)