Browse Source

[2861] Test that we abort on unexpected errors

Michal 'vorner' Vaner 11 years ago
parent
commit
009e306698
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/bin/auth/tests/datasrc_clients_builder_unittest.cc

+ 10 - 0
src/bin/auth/tests/datasrc_clients_builder_unittest.cc

@@ -131,6 +131,16 @@ TEST_F(DataSrcClientsBuilderTest, commandFinished) {
     EXPECT_EQ(1, result);
     EXPECT_EQ(1, result);
 }
 }
 
 
+// Test that low-level errors with the synchronization socket
+// (an unexpected condition) is detected and program aborted.
+TEST_F(DataSrcClientsBuilderTest, finishedCrash) {
+    command_queue.push_back(Command(SHUTDOWN, ConstElementPtr(),
+                                    emptyCallsback));
+    // Break the socket
+    close(write_end);
+    EXPECT_DEATH_IF_SUPPORTED({builder.run();}, "");
+}
+
 TEST_F(DataSrcClientsBuilderTest, runMultiCommands) {
 TEST_F(DataSrcClientsBuilderTest, runMultiCommands) {
     // Two NOOP commands followed by SHUTDOWN.  We should see two doNoop()
     // Two NOOP commands followed by SHUTDOWN.  We should see two doNoop()
     // calls.
     // calls.