Skip to content

Commit

Permalink
Minor refactor of MoQSessionTest
Browse files Browse the repository at this point in the history
Summary: So we can use setupMoQSession in subsequent tests

Reviewed By: NEUDitao

Differential Revision: D66563096

fbshipit-source-id: 1aa0b3e4d34a73ded90e2e4e1b94b454be038eac
  • Loading branch information
afrind authored and facebook-github-bot committed Dec 3, 2024
1 parent 6d06c50 commit 0e42a14
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions moxygen/test/MoQSessionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ class MoQSessionTest : public testing::Test,
.asUint64 = kTestMaxSubscribeId}}}});
}

void setupMoQSession();

protected:
folly::EventBase eventBase_;
std::unique_ptr<proxygen::test::FakeSharedWebTransport> clientWt_;
Expand All @@ -162,9 +164,8 @@ class MoQSessionTest : public testing::Test,
uint64_t negotiatedVersion_ = kVersionDraftCurrent;
bool failServerSetup_{false};
};
} // namespace

TEST_F(MoQSessionTest, Setup) {
void MoQSessionTest::setupMoQSession() {
clientSession_->start();
serverSession_->start();
eventBase_.loopOnce();
Expand All @@ -180,7 +181,7 @@ TEST_F(MoQSessionTest, Setup) {
serverSetup.params.at(0).key,
folly::to_underlying(SetupKey::MAX_SUBSCRIBE_ID));
EXPECT_EQ(serverSetup.params.at(0).asUint64, kTestMaxSubscribeId);
clientSession->close();
clientSession->getEventBase()->terminateLoopSoon();
}(clientSession_)
.scheduleOn(&eventBase_)
.start();
Expand All @@ -192,6 +193,12 @@ TEST_F(MoQSessionTest, Setup) {
.start();
eventBase_.loop();
}
} // namespace

TEST_F(MoQSessionTest, Setup) {
setupMoQSession();
clientSession_->close();
}

// receive bidi stream on client

Expand Down

0 comments on commit 0e42a14

Please sign in to comment.