yugabyte / debezium-connector-yugabytedb

A Debezium CDC connector for the YugabyteDB database
https://docs.yugabyte.com/stable/explore/change-data-capture/using-logical-replication/yugabytedb-connector/
Apache License 2.0
12 stars 8 forks source link

Fix flakiness in the test infra #311

Closed vaibhav-yb closed 9 months ago

vaibhav-yb commented 11 months ago

Problem

There are some related problems we are tracking here:

  1. We do not have a cleaner way to set Gflags and start yugabyted inside the container. If we have to change/add one GFlag, we may need to make additional modifications to the test, for example, in YugabyteDBTabletSplitTest
  2. Some tests are flaky and are not modified according to the consistent snapshot behaviour, as a result they end up failing at the assertion stages where we verify the count.

Solution

This PR fixes the flakiness behaviour of the tests as well as introduces methods in the TestBaseClass i.e. setMasterFlags and setTserverFlags which will help simplify the process.

Usage

The methods are to be used before the initializeYBContainer() method and if the container is started separately in the test then the flags need to be set before obtaining the container. For example:

public static void beforeAll() {
  setMasterFlags(masterFlags);
  setTserverFlags(tserverFlags);
  initializeYBContainer();
}
  // test code
  setMasterFlags(masterFlags);
  setTserverFlags(tserverFlags);
  ybContainer = TestHelper.getYbContainer();
  // further test code