Skip to content

Commit

Permalink
Add a test for this behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
smarthall committed Jul 26, 2024
1 parent 8e0b9a6 commit 11ef820
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/clustertest/tests/ControlCommandTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ struct ControlCommandTest : tpunit::TestFixture {
: tpunit::TestFixture("ControlCommand",
BEFORE_CLASS(ControlCommandTest::setup),
AFTER_CLASS(ControlCommandTest::teardown),
TEST(ControlCommandTest::testPreventAttach)) { }
TEST(ControlCommandTest::testPreventAttach),
TEST(ControlCommandTest::testDoubleDetach)) { }

BedrockClusterTester* tester;

Expand Down Expand Up @@ -46,4 +47,19 @@ struct ControlCommandTest : tpunit::TestFixture {
follower.executeWaitVerifyContent(attachCommand, "204", true);
}

void testDoubleDetach()
{
// Test a control command
BedrockTester& follower = tester->getTester(1);

// Detach
SData detachCommand("detach");
follower.executeWaitVerifyContent(detachCommand, "203 DETACHING", true);

// Wait for it to detach
sleep(3);

follower.executeWaitVerifyContent(detachCommand, "400 Already detached", true);
}

} __ControlCommandTest;

0 comments on commit 11ef820

Please sign in to comment.