@@ -21,7 +21,6 @@ using namespace swss;
2121static const string dbhost = " localhost" ;
2222static const int dbport = 6379 ;
2323static const string testTableName = " UT_REDIS_TABLE" ;
24- static const string testTableName2 = " UT_REDIS_TABLE2" ;
2524
2625static inline int getMaxFields (int i)
2726{
@@ -431,92 +430,3 @@ TEST(SubscriberStateTable, one_producer_multiple_subscriber)
431430 }
432431 cout << endl << " Done." << endl;
433432}
434-
435- TEST (SubscriberStateTable, cachedData)
436- {
437- clearDB ();
438-
439- /* Prepare init data */
440- int index = 0 ;
441- int maxNumOfFields = 2 ;
442-
443- DBConnector db (TEST_DB, dbhost, dbport, 0 );
444- Table p (&db, testTableName);
445- string key1 = " TheKey1" ;
446- /* Set operation */
447- {
448- vector<FieldValueTuple> fields;
449- for (int j = 0 ; j < maxNumOfFields; j++)
450- {
451- FieldValueTuple t (field (index, j), value (index, j));
452- fields.push_back (t);
453- }
454- p.set (key1, fields);
455- }
456-
457- Table p2 (&db, testTableName2);
458- string key2 = " TheKey2" ;
459- /* Set operation */
460- {
461- vector<FieldValueTuple> fields;
462- for (int j = 0 ; j < maxNumOfFields; j++)
463- {
464- FieldValueTuple t (field (index, j), value (index, j));
465- fields.push_back (t);
466- }
467- p2.set (key2, fields);
468- }
469-
470- /* Prepare subscriber */
471- SubscriberStateTable c1 (&db, testTableName);
472- SubscriberStateTable c2 (&db, testTableName2);
473- Select cs;
474- Selectable *selectcs;
475- cs.addSelectable (&c1);
476- cs.addSelectable (&c2);
477-
478- /* Pop operation and check CachedSelectable */
479- {
480- string key = key1;
481- int ret = cs.select (&selectcs);
482- EXPECT_EQ (ret, Select::OBJECT);
483- KeyOpFieldsValuesTuple kco;
484- if (selectcs == &c1)
485- {
486- c1.pop (kco);
487- }
488- else
489- {
490- c2.pop (kco);
491- key = key2;
492- }
493-
494- EXPECT_EQ (kfvKey (kco), key);
495- EXPECT_EQ (kfvOp (kco), " SET" );
496-
497- /* There is one cached selectable left */
498- bool r = cs.isQueueEmpty ();
499- EXPECT_FALSE (r);
500-
501- ret = cs.select (&selectcs);
502- EXPECT_EQ (ret, Select::OBJECT);
503- if (key == key1)
504- {
505- EXPECT_TRUE (selectcs == &c2);
506- key = key2;
507- c2.pop (kco);
508- }
509- else
510- {
511- EXPECT_TRUE (selectcs == &c1);
512- key = key1;
513- c1.pop (kco);
514- }
515-
516- EXPECT_EQ (kfvKey (kco), key);
517- EXPECT_EQ (kfvOp (kco), " SET" );
518- /* No cached selectable left */
519- r = cs.isQueueEmpty ();
520- EXPECT_TRUE (r);
521- }
522- }
0 commit comments