anchor.diff:      timer:sleep(5000),
       wait_for_database_flush(couchbase_config:get_flush_queue_size()).
   
  --spec check_db_connection_loop(read | {write, binary()}, string()) -> ok.
  -check_db_connection_loop(TestOperation, InfoLog) ->
  +-spec db_action_loop(read | {write, binary()}, string()) -> ok.
  +db_action_loop(Operation, InfoLog) ->
       CheckAns = try
  -        case TestOperation of
  +        case Operation of
               read -> read_application_closing_status();
               {write, Value} -> perform_test_db_write(Value)
           end
  
positive.code: -spec check_db_connection() -> ok.
  check_db_connection() ->
      ?info("Waiting for database readiness..."),
      check_db_connection_loop(read, "Database not ready yet..."),
      check_db_connection_loop({write, ?TEST_DOC_INIT_VALUE}, "Database not ready yet..."),
      ?info("Database ready").
  
  -spec get_application_closing_status() -> closing_status().
  
negative.code: cleanup() ->
      wait_for_database_flush(),
      ?info("All regural documents flushed. Saving information about application closing"),
      db_action_loop({write, ?TEST_DOC_FINAL_VALUE}, "Waiting to save information about application closing"),
      wait_for_database_flush().
  
  %%%===================================================================
  