Skip to content

Latest commit

 

History

History
 
 

test-dds-utils

@fluid-private/test-dds-utils

Utilities for writing unit tests for DDS in Fluid Framework.

NOTE: This package is private to the @microsoft/fluid-framework repository. It is not published, and therefore may only be used in packages within the same pnpm workspace in this repo using the workspace:* schema. Since this package is not published, it may also only be used as a dev dependency, or as a dependency in packages that are not published.

Garbage Collection (GC) unit tests

gcTestRunner provides a set of tests for validating that the DDSes return correct GC nodes.

To write GC tests for a DDS, call runGCTests with a class that implements the following interface:

export interface IGCTestProvider {
	/** The DDS whose GC data is to be verified */
	readonly sharedObject: ISharedObject;
	/** The expected list of outbound routes from this DDS */
	readonly expectedOutboundRoutes: string[];
	/** Function that adds routes to Fluid objects to the DDS' data */
	addOutboundRoutes(): Promise<void>;
	/** Function that deletes routes to Fluid objects to the DDS' data */
	deleteOutboundRoutes(): Promise<void>;
	/** Function that adds nested handles to the DDS' data */
	addNestedHandles(): Promise<void>;
}

The caller is responsible for the following:

  1. Adding and deleting routes to Fluid objects to the DDS which is being tested.
  2. Adding nested handles to the DDS' data.
  3. Maintaining the list of expected outbound routes. The tests query this and validates that the GC data returned by the DDS matches these routes.

Examples

SharedCell and SharedDirectory have tests that use the gcTestRunner for validating GC data.

Eventual Consistency Fuzz Tests

This package also provides a generic harness for writing eventual consistency fuzz tests for a DDS. This model is written using @fluid-private/stochastic-test-utils. See documentation on createDDSFuzzSuite and DDSFuzzModel for more details.

The harness currently supports testing eventual consistency of op application using Fluid's set of mocks including the reconnect flow.

Future Improvements

The generic aspects of this model could be improved to fuzz test correctness a few other general concerns DDS authors have:

  • Summarization correctness
  • Offline (applyStashedOp implementation)

Contribution Guidelines

There are many ways to contribute to Fluid.

Detailed instructions for working in the repo can be found in the Wiki.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. Use of these trademarks or logos must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

Help

Not finding what you're looking for in this README? Check out fluidframework.com.

Still not finding what you're looking for? Please file an issue.

Thank you!

Trademark

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.

Use of these trademarks or logos must follow Microsoft's Trademark & Brand Guidelines.

Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.