Skip to content

Commit d94a8d1

Browse files
Additional cleanup (removed AI comments, consolidated token IDs)
1 parent 10cf19d commit d94a8d1

9 files changed

Lines changed: 38 additions & 41 deletions

File tree

.github/workflows/tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ jobs:
176176
--gtest_output="xml:build-release\unit-test-results.xml"
177177
178178
# ---------- Install + start livekit-server for integration tests ----------
179-
# E2E (livekit-server-backed) tests run on Linux + macOS only, mirroring
180-
# the Rust SDK's tests.yml which gates these steps with `matrix.e2e-testing`.
181-
# Windows skips them entirely; build + unit tests still run on every platform.
182179
- name: Install livekit-server and lk CLI
183180
if: matrix.e2e-testing
184181
shell: bash

.token_helpers/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Generate tokens and then set them as env vars for the current terminal session
77
## set_data_track_test_tokens.bash
88
Generate the two participant tokens required by the C++ SDK's integration
99
and stress test suites (data tracks, RPC, media multistream, etc.) and
10-
export them as `LK_TOKEN_TEST_A`, `LK_TOKEN_TEST_B`, and `LIVEKIT_URL` for
10+
export them as `LIVEKIT_TOKEN_A`, `LIVEKIT_TOKEN_B`, and `LIVEKIT_URL` for
1111
the current terminal session.

.token_helpers/set_data_track_test_tokens.bash

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# eval "$(bash .token_helpers/set_data_track_test_tokens.bash)"
2222
#
2323
# Exports:
24-
# LK_TOKEN_TEST_A
25-
# LK_TOKEN_TEST_B
24+
# LIVEKIT_TOKEN_A
25+
# LIVEKIT_TOKEN_B
2626
# LIVEKIT_URL=ws://localhost:7880
2727
#
2828

@@ -103,24 +103,24 @@ _create_token() {
103103
printf '%s' "$token"
104104
}
105105

106-
LK_TOKEN_TEST_A="$(_create_token "$LIVEKIT_IDENTITY_A")"
107-
LK_TOKEN_TEST_B="$(_create_token "$LIVEKIT_IDENTITY_B")"
106+
LIVEKIT_TOKEN_A="$(_create_token "$LIVEKIT_IDENTITY_A")"
107+
LIVEKIT_TOKEN_B="$(_create_token "$LIVEKIT_IDENTITY_B")"
108108

109109
_apply() {
110-
export LK_TOKEN_TEST_A
111-
export LK_TOKEN_TEST_B
110+
export LIVEKIT_TOKEN_A
111+
export LIVEKIT_TOKEN_B
112112
export LIVEKIT_URL
113113
}
114114

115115
_emit_eval() {
116-
printf 'export LK_TOKEN_TEST_A=%q\n' "$LK_TOKEN_TEST_A"
117-
printf 'export LK_TOKEN_TEST_B=%q\n' "$LK_TOKEN_TEST_B"
116+
printf 'export LIVEKIT_TOKEN_A=%q\n' "$LIVEKIT_TOKEN_A"
117+
printf 'export LIVEKIT_TOKEN_B=%q\n' "$LIVEKIT_TOKEN_B"
118118
printf 'export LIVEKIT_URL=%q\n' "$LIVEKIT_URL"
119119
}
120120

121121
if [[ "$_sourced" -eq 1 ]]; then
122122
_apply
123-
echo "LK_TOKEN_TEST_A, LK_TOKEN_TEST_B, and LIVEKIT_URL set for this shell." >&2
123+
echo "LIVEKIT_TOKEN_A, LIVEKIT_TOKEN_B, and LIVEKIT_URL set for this shell." >&2
124124
else
125125
_emit_eval
126126
echo "set_data_track_test_tokens.bash: for this shell run: source $0 or: eval \"\$(bash $0 ...)\"" >&2

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,8 @@ etc.) require a LiveKit server and two participant tokens:
429429
```bash
430430
# Required
431431
export LIVEKIT_URL="ws://localhost:7880" # or wss://your-server.livekit.cloud
432-
export LK_TOKEN_TEST_A="<first participant token>"
433-
export LK_TOKEN_TEST_B="<second participant token>"
432+
export LIVEKIT_TOKEN_A="<first participant token>"
433+
export LIVEKIT_TOKEN_B="<second participant token>"
434434

435435
# Optional (for stress tests)
436436
export RPC_STRESS_DURATION_SECONDS=3600 # Test duration (default: 1 hour)
@@ -441,7 +441,7 @@ export RPC_STRESS_CALLER_THREADS=4 # Concurrent caller threads (default:
441441

442442
The easiest path is to source the helper script, which will mint both
443443
participant tokens against a local `livekit-server --dev` and export
444-
`LK_TOKEN_TEST_A`, `LK_TOKEN_TEST_B`, and `LIVEKIT_URL` for the current shell:
444+
`LIVEKIT_TOKEN_A`, `LIVEKIT_TOKEN_B`, and `LIVEKIT_URL` for the current shell:
445445

446446
```bash
447447
source .token_helpers/set_data_track_test_tokens.bash

src/tests/common/test_common.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ constexpr char kLocalTestLiveKitUrl[] = "ws://localhost:7880";
7070
*
7171
* Environment variables:
7272
* LIVEKIT_URL - WebSocket URL of the LiveKit server
73-
* LK_TOKEN_TEST_A - Token for the first test participant
74-
* LK_TOKEN_TEST_B - Token for the second test participant
73+
* LIVEKIT_TOKEN_A - Token for the first test participant
74+
* LIVEKIT_TOKEN_B - Token for the second test participant
7575
* TEST_ITERATIONS - Number of iterations for iterative tests (default:
7676
* 10) STRESS_DURATION_SECONDS - Duration for stress tests in seconds (default:
7777
* 600) STRESS_CALLER_THREADS - Number of caller threads for stress tests
@@ -89,8 +89,8 @@ struct TestConfig {
8989
static TestConfig fromEnv() {
9090
TestConfig config;
9191
const char *url = std::getenv("LIVEKIT_URL");
92-
const char *token_a = std::getenv("LK_TOKEN_TEST_A");
93-
const char *token_b = std::getenv("LK_TOKEN_TEST_B");
92+
const char *token_a = std::getenv("LIVEKIT_TOKEN_A");
93+
const char *token_b = std::getenv("LIVEKIT_TOKEN_B");
9494
const char *iterations_env = std::getenv("TEST_ITERATIONS");
9595
const char *duration_env = std::getenv("STRESS_DURATION_SECONDS");
9696
const char *threads_env = std::getenv("STRESS_CALLER_THREADS");
@@ -142,17 +142,17 @@ inline bool waitForParticipant(Room *room, const std::string &identity,
142142
}
143143

144144
inline std::array<std::string, 2> getDataTrackTestTokens() {
145-
const char *token_a = std::getenv("LK_TOKEN_TEST_A");
145+
const char *token_a = std::getenv("LIVEKIT_TOKEN_A");
146146
if (token_a == nullptr || std::string(token_a).empty()) {
147147
throw std::runtime_error(
148-
"LK_TOKEN_TEST_A must be present and non-empty for data track E2E "
148+
"LIVEKIT_TOKEN_A must be present and non-empty for data track E2E "
149149
"tests");
150150
}
151151

152-
const char *token_b = std::getenv("LK_TOKEN_TEST_B");
152+
const char *token_b = std::getenv("LIVEKIT_TOKEN_B");
153153
if (token_b == nullptr || std::string(token_b).empty()) {
154154
throw std::runtime_error(
155-
"LK_TOKEN_TEST_B must be present and non-empty for data track E2E "
155+
"LIVEKIT_TOKEN_B must be present and non-empty for data track E2E "
156156
"tests");
157157
}
158158

@@ -216,7 +216,7 @@ testRooms(const std::vector<TestRoomConnectionOptions> &room_configs) {
216216

217217
if (room_configs.size() > 2) {
218218
throw std::invalid_argument(
219-
"testRooms supports at most two rooms with LK_TOKEN_TEST_A/B");
219+
"testRooms supports at most two rooms with LIVEKIT_TOKEN_A/LIVEKIT_TOKEN_B");
220220
}
221221

222222
auto tokens = getDataTrackTestTokens();
@@ -516,7 +516,7 @@ class LiveKitTestBase : public ::testing::Test {
516516
void skipIfNotConfigured() {
517517
if (!config_.available) {
518518
GTEST_SKIP()
519-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
519+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
520520
}
521521
}
522522

src/tests/integration/test_media_multistream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void MediaMultiStreamIntegrationTest::runPublishTwoVideoAndTwoAudioTracks(
8787
bool single_peer_connection) {
8888
if (!config_.available) {
8989
GTEST_SKIP()
90-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
90+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
9191
}
9292

9393
RoomOptions options;

src/tests/integration/test_room.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ TEST_F(RoomTest, RemoteParticipantLookupBeforeConnect) {
9898
<< "Looking up participant before connect should return nullptr";
9999
}
100100

101-
// Server-dependent tests - require LIVEKIT_URL and LK_TOKEN_TEST_A env vars
101+
// Server-dependent tests - require LIVEKIT_URL and LIVEKIT_TOKEN_A env vars
102102
class RoomServerTest : public ::testing::Test {
103103
protected:
104104
void SetUp() override {
105105
livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole);
106106

107107
const char *url_env = std::getenv("LIVEKIT_URL");
108-
const char *token_env = std::getenv("LK_TOKEN_TEST_A");
108+
const char *token_env = std::getenv("LIVEKIT_TOKEN_A");
109109

110110
if (url_env && token_env) {
111111
server_url_ = url_env;
@@ -123,7 +123,7 @@ class RoomServerTest : public ::testing::Test {
123123

124124
TEST_F(RoomServerTest, ConnectToServer) {
125125
if (!server_available_) {
126-
GTEST_SKIP() << "LIVEKIT_URL and LK_TOKEN_TEST_A not set, skipping server "
126+
GTEST_SKIP() << "LIVEKIT_URL and LIVEKIT_TOKEN_A not set, skipping server "
127127
"connection test";
128128
}
129129

src/tests/integration/test_rpc.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ struct RpcTestConfig {
4343
static RpcTestConfig fromEnv() {
4444
RpcTestConfig config;
4545
const char *url = std::getenv("LIVEKIT_URL");
46-
const char *token_a = std::getenv("LK_TOKEN_TEST_A");
47-
const char *token_b = std::getenv("LK_TOKEN_TEST_B");
46+
const char *token_a = std::getenv("LIVEKIT_TOKEN_A");
47+
const char *token_b = std::getenv("LIVEKIT_TOKEN_B");
4848

4949
if (url && token_a && token_b) {
5050
config.url = url;
@@ -118,7 +118,7 @@ class RpcIntegrationTest : public ::testing::Test {
118118
TEST_F(RpcIntegrationTest, BasicRpcRoundTrip) {
119119
if (!config_.available) {
120120
GTEST_SKIP()
121-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
121+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
122122
}
123123

124124
// Create receiver room
@@ -188,7 +188,7 @@ TEST_F(RpcIntegrationTest, BasicRpcRoundTrip) {
188188
TEST_F(RpcIntegrationTest, MaxPayloadSize) {
189189
if (!config_.available) {
190190
GTEST_SKIP()
191-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
191+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
192192
}
193193

194194
auto receiver_room = std::make_unique<Room>();
@@ -233,7 +233,7 @@ TEST_F(RpcIntegrationTest, MaxPayloadSize) {
233233
TEST_F(RpcIntegrationTest, RpcTimeout) {
234234
if (!config_.available) {
235235
GTEST_SKIP()
236-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
236+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
237237
}
238238

239239
auto receiver_room = std::make_unique<Room>();
@@ -280,7 +280,7 @@ TEST_F(RpcIntegrationTest, RpcTimeout) {
280280
TEST_F(RpcIntegrationTest, UnsupportedMethod) {
281281
if (!config_.available) {
282282
GTEST_SKIP()
283-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
283+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
284284
}
285285

286286
auto receiver_room = std::make_unique<Room>();
@@ -320,7 +320,7 @@ TEST_F(RpcIntegrationTest, UnsupportedMethod) {
320320
TEST_F(RpcIntegrationTest, ApplicationError) {
321321
if (!config_.available) {
322322
GTEST_SKIP()
323-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
323+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
324324
}
325325

326326
auto receiver_room = std::make_unique<Room>();
@@ -367,7 +367,7 @@ TEST_F(RpcIntegrationTest, ApplicationError) {
367367
TEST_F(RpcIntegrationTest, ConcurrentRpcCalls) {
368368
if (!config_.available) {
369369
GTEST_SKIP()
370-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
370+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
371371
}
372372

373373
auto receiver_room = std::make_unique<Room>();
@@ -435,7 +435,7 @@ TEST_F(RpcIntegrationTest, ConcurrentRpcCalls) {
435435
TEST_F(RpcIntegrationTest, OneMinuteIntegration) {
436436
if (!config_.available) {
437437
GTEST_SKIP()
438-
<< "LIVEKIT_URL, LK_TOKEN_TEST_A, and LK_TOKEN_TEST_B not set";
438+
<< "LIVEKIT_URL, LIVEKIT_TOKEN_A, and LIVEKIT_TOKEN_B not set";
439439
}
440440

441441
auto receiver_room = std::make_unique<Room>();

src/tests/stress/test_room_stress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class RoomServerStressTest : public ::testing::Test {
192192
livekit::initialize(livekit::LogLevel::Info, livekit::LogSink::kConsole);
193193

194194
const char *url_env = std::getenv("LIVEKIT_URL");
195-
const char *token_env = std::getenv("LK_TOKEN_TEST_A");
195+
const char *token_env = std::getenv("LIVEKIT_TOKEN_A");
196196

197197
if (url_env && token_env) {
198198
server_url_ = url_env;
@@ -210,7 +210,7 @@ class RoomServerStressTest : public ::testing::Test {
210210

211211
TEST_F(RoomServerStressTest, RepeatedConnectDisconnect) {
212212
if (!server_available_) {
213-
GTEST_SKIP() << "LIVEKIT_URL and LK_TOKEN_TEST_A not set, skipping server "
213+
GTEST_SKIP() << "LIVEKIT_URL and LIVEKIT_TOKEN_A not set, skipping server "
214214
"stress test";
215215
}
216216

0 commit comments

Comments
 (0)