anchor.diff:          {ok, _, _} ->
               ok;
           Error ->
  -            ?debug("Test db ~p failed with error ~p", [TestOperation, Error]),
  +            ?debug("Test db ~p failed with error ~p", [Operation, Error]),
               ?info(InfoLog),
               timer:sleep(?SAVE_CHECK_INTERVAL),
  -            check_db_connection_loop(TestOperation, InfoLog)
  +            db_action_loop(Operation, InfoLog)
       end.
   
   -spec read_application_closing_status() -> ok | {error, term()}.
   read_application_closing_status() ->
       Ctx = datastore_model_default:get_default_disk_ctx(),
       case couchbase_driver:get(Ctx, ?TEST_DOC_KEY) of
  -        {ok, _, ?TEST_DOC_INIT_VALUE} ->
  +        {ok, _, #document{value = ?TEST_DOC_INIT_VALUE}} ->
               application:set_env(?CLUSTER_WORKER_APP_NAME,
                   ?APPLICATION_CLOSING_STATUS_ENV, last_closing_procedure_failed);
  -        {ok, _, ?TEST_DOC_FINAL_VALUE} ->
  +        {ok, _, #document{value = ?TEST_DOC_FINAL_VALUE}} ->
               application:set_env(?CLUSTER_WORKER_APP_NAME, ?
               APPLICATION_CLOSING_STATUS_ENV, last_closing_procedure_succeded);
           {error, not_found} ->
  
positive.code: cleanup() ->
      wait_for_database_flush(),
      ?info("All regural documents flushed. Saving information about application closing"),
      check_db_connection_loop({write, ?TEST_DOC_INIT_VALUE}, "Waiting to save information about application closing"),
      wait_for_database_flush().
  
  %%%===================================================================
  
negative.code: -spec check_db_connection() -> ok.
  check_db_connection() ->
      ?info("Waiting for database readiness..."),
      db_action_loop(read, "Database not ready yet..."),
      db_action_loop({write, ?TEST_DOC_INIT_VALUE}, "Database not ready yet..."),
      ?info("Database ready").
  
  -spec get_application_closing_status() -> closing_status().
  