@@ -318,7 +318,11 @@ TEST_F(SchedUnitTests, testScheduleQueryBeforeConnection)
318318
319319 lcb_CMDQUERY *cmd;
320320 lcb_cmdquery_create (&cmd);
321- std::string statement (" SELECT 'hello' AS greeting" );
321+
322+ // the statement must be valid, and always return success, otherwise the library might try to refresh config, which
323+ // will interfere with has_pending() check
324+ std::string statement =
325+ MockEnvironment::getInstance ()->isRealCluster () ? " SELECT 'hello' AS greeting" : " SELECT mockrow" ;
322326 lcb_cmdquery_statement (cmd, statement.c_str (), statement.size ());
323327 lcb_cmdquery_callback (cmd, queryCallback);
324328 size_t counter = 0 ;
@@ -333,11 +337,7 @@ TEST_F(SchedUnitTests, testScheduleQueryBeforeConnection)
333337 ASSERT_STATUS_EQ (LCB_SUCCESS, lcb_get_bootstrap_status (instance));
334338 ASSERT_FALSE (instance->has_deferred_operations ());
335339 ASSERT_FALSE (hasPendingOps (instance));
336- if (MockEnvironment::getInstance ()->isRealCluster ()) {
337- ASSERT_EQ (2 , counter); /* single row + meta */
338- } else {
339- ASSERT_EQ (1 , counter); /* reduced implementation */
340- }
340+ ASSERT_EQ (2 , counter); /* single row + meta */
341341}
342342
343343static void searchCallback (lcb_INSTANCE *, int , const lcb_RESPSEARCH *resp)
@@ -434,6 +434,10 @@ TEST_F(SchedUnitTests, testScheduleViewBeforeConnection)
434434
435435 MockEnvironment::getInstance ()->createConnection (hw, &instance);
436436
437+ /* disable config refresh after http failure to make pending request check more predictable */
438+ int enable = 0 ;
439+ lcb_cntl (instance, LCB_CNTL_SET, LCB_CNTL_HTTP_REFRESH_CONFIG_ON_ERROR, &enable);
440+
437441 lcb_CMDVIEW *cmd;
438442 lcb_cmdview_create (&cmd);
439443 std::string design_document (" does_not_exist" );
0 commit comments