1.4.0 • Published 8 months ago

@fluidframework/test-version-utils v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@fluidframework/test-version-utils

This is a package for writing and setting up Fluid end to end tests using mocha that will generate variants with a specific driver and different version combinations of Fluid API between layers via TestObjectProvider provided to the test. The different layers are loader, driver, container runtime and data runtime (includes DDS). Version combinations and driver selection can be controlled via the mocha command line, assuming your test uses the provided describe* functions. For advanced usage, a test can bypass this mechanism and directly call our exports to get the versioned Fluid APIs.

Versioned combination test generation

Layer version combinations

Similar to mocha's describe, this package provide various describe* functions that will generate variants with a specific driver and different version combinations of Fluid API between layers. All possible layer combinations that are generated (empty entries are current versions):

Compat KindLoaderDriverContainer RuntimeData Runtime
None
Loaderold
Driverold
ContainerRuntimeold
DataRuntimeold
NewLoaderoldoldold
NewDriveroldoldold
NewContainerRuntimeoldoldold
NewDataRuntimeoldoldold

Mocha test setup with layer version combinations

There are three compat describe* to generate different combinations, depending of the need of the tests

describeFullCompat: generate test variants with compat combinations that varies the version for all layers.

  • Used for tests that exercise all layers and will benefits compat combinations of all layers.

describeLoaderCompat: generate test variants with compat combinations that only varies the loader version.

describeNoCompat - generate one test variant that doesn't varies version of any layers.

  • Use for tests that doesn't benefit or require any compat testing.
  • Test combination generated: CompatKind.None

These compat describe* functions will also load the APIs with appropriate version and provide the test with a TestObjectProvider object, where the test can use to access Fluid functionality. Even when compat testing is not necessary, TestObjectProvider provide functionalities that help writing Fluid tests, and it allows the test to enable compat testing easily in the future just by changing the describe*.

Legacy version defaults and installation

By default, N-1, N-2, and LTS (hard coded) test variants are generated. The versions can be specified using command line (see below) to run the test against any two versions. This package includes a mocha global hook that will install legacy packages at the beginning of the package based on the compatVersion settings.

Command line options

Tests using the compat describe* will be controllable using the command line options when running mocha on driver selection, versions for compat testing, and compat kind combinations.

--compatKind <CompatKind> - filter to the compat variant. See above table. Can be specified multiple times.
                                Default: undefined (no filter)
--compatVersion <version> - specify the old version. Relative (to base) or specific version. Can be specified multiple times.
                                Default: -1, -2, LTS (hard coded in src/compatConfig.ts)
--baseVersion <version>   - specify the base (new) version. Allow the test to run against any version combinations.
                                Default: <current> (same version of the test package)
--driver <driverType>     - <driverType> = "tinylicious" | "t9s" | "routerlicious" | "r11s" | "odsp" | "local"
                                Default: "local"
--r11sEndpointName <name> - Determine the environment variable name to look for r11s service information to target.
                                Default: "r11s"
--tenantIndex <number>    - Index into the tenant list, modulo the number of tenant available, for odsp server info to target.
                                Default: 0
--reinstall               - Force reinstall any required versions.  Default: reuse if a version is already installed.

baseVersion is a semver or a semver range.

  • If it is a semver range, the latest in that range will be picked.

compatVersion can be a semver or semver range or an integer apply to the minor version relative to baseVersion

  • If it is a semver range, the latest in that range will be picked.
  • If it is an integer, the value will be apply to the minor version of the baseVersion, and create a ^ range including prerelease versions. The latest in that range will be picked.
    • i.e. if baseVersion is 0.2.3, and compatVersion is -1, the resulting range will be ^0.1.3-0

We also accept some of the flags via environment variables.

Environment VariablesCommand line options
fluidtestcompatKind--compatKind
fluidtestcompatVersion--compatVersion
fluidtestdriver--driver
fluidtestr11sEndpointName--r11sEndpointName
fluidtestbaseVersion--baseVersion

Advanced usage

This bypasses any configuration of version used by the describe* functions and provides direct access to the versioned APIs.

First make sure to call ensurePackageInstalled before running the tests to make sure the necessary legacy version are installed.

The main entry point is getVersionedTestObjectProvider to get a TestObjectProvider for a specific version combinations and driver config. Additionally, you can get versioned API for specific layers using these API.

  • getLoaderApi
  • getDriverApi
  • getContainerRuntimeApi
  • getDataRuntimeApi

All these API returns the current version by default if no arguments is passed. If a number is provided, a relative version will be computed by adding the number to the minor version number of the current version, and find the latest patch version. (^0.<current+requested>.0). If a string is provided, then the string is treated as a specific version or a range of version, and it will resolve the latest version that matches it.

OPEN ISSUE: while these API can be used directly, currently the default global mocha hook will still run and install the default set of legacy versions whether it is necessary or not.

Implementation notes

The legacy version are installed in their own version folder ./../node_modules/.legacy/<version> (current package root's node_module directory).

Legacy versions of all packages in all categories are installed regardless of what compat combination is requested. (See packageList in src/testApi.ts).

For now, the current version are statically bound to also provide type. Although it can be switch to dynamic loading for consistency (or don't want to force the script to be loaded if they are not needed). Currently, we don't have such scenario yet.

1.4.0

8 months ago

1.3.7

1 year ago

1.3.6

2 years ago

1.3.5-121405

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.2.8

2 years ago

1.4.0-121020

2 years ago

1.4.0-111997

2 years ago

1.3.3

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.4.0-115997

2 years ago

1.3.2-112998

2 years ago

1.4.0-108057

2 years ago

1.4.0-106438

2 years ago

1.3.0-97515

2 years ago

1.3.0-100520

2 years ago

1.2.7

2 years ago

0.59.4003

2 years ago

1.2.6-93452

2 years ago

1.2.6

2 years ago

0.59.2004

2 years ago

1.2.0

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0-78837

2 years ago

1.2.3-84921

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.2.0-77818

2 years ago

1.1.0-75972

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.2.3-83900

2 years ago

1.1.0-76254

2 years ago

0.59.4002

2 years ago

0.59.2002

3 years ago

0.59.2003

2 years ago

0.59.3003

2 years ago

0.59.3001

2 years ago

0.59.3002

2 years ago

0.59.3000

3 years ago

1.0.0

2 years ago

0.59.1001

3 years ago

0.59.3000-67119

3 years ago

0.59.4000-71130

2 years ago

0.59.4000-71128

2 years ago

0.59.4000

2 years ago

0.59.4001

2 years ago

0.59.2001

3 years ago

0.59.3000-66610

3 years ago

0.59.2000

3 years ago

0.59.1001-62246

3 years ago

0.59.2000-63294

3 years ago

0.59.1000-61898

3 years ago

0.59.2000-61729

3 years ago

0.59.1000

3 years ago

0.58.3000-61081

3 years ago

0.56.11

3 years ago

0.56.10

3 years ago

0.58.2000-58133

3 years ago

0.58.2000

3 years ago

0.58.2002

3 years ago

0.58.2001

3 years ago

0.58.1000

3 years ago

0.58.1001

3 years ago

0.55.4

3 years ago

0.55.2

3 years ago

0.55.3

3 years ago

0.55.0

3 years ago

0.55.1

3 years ago

0.57.0-51086

3 years ago

0.55.0-48551

3 years ago

0.56.5

3 years ago

0.56.6

3 years ago

0.56.3

3 years ago

0.56.4

3 years ago

0.56.1

3 years ago

0.56.2

3 years ago

0.58.0-55983

3 years ago

0.56.0

3 years ago

0.54.0-47413

3 years ago

0.56.9

3 years ago

0.56.7

3 years ago

0.56.8

3 years ago

0.57.2

3 years ago

0.57.0

3 years ago

0.57.1

3 years ago

0.58.0-55561

3 years ago

0.54.3

3 years ago

0.54.1

3 years ago

0.56.0-49831

3 years ago

0.54.2

3 years ago

0.54.0

3 years ago

0.53.0

3 years ago

0.53.0-46105

3 years ago

0.52.0-44610

3 years ago

0.51.2

3 years ago

0.51.3

3 years ago

0.51.0

3 years ago

0.51.1

3 years ago

0.51.0-43124

3 years ago

0.52.1

3 years ago

0.52.0

3 years ago

0.50.3

3 years ago

0.50.4

3 years ago

0.50.2

3 years ago

0.50.1

3 years ago

0.50.0

3 years ago

0.50.0-41540

3 years ago

0.50.0-41365

3 years ago

0.49.1

3 years ago

0.49.2

3 years ago

0.49.0

3 years ago

0.49.0-39313

3 years ago

0.48.5

3 years ago

0.48.4

3 years ago

0.48.3

3 years ago

0.49.0-39015

3 years ago

0.48.2

3 years ago

0.48.1

3 years ago

0.48.0

3 years ago

0.48.0-38142

3 years ago

0.48.0-38105

3 years ago

0.46.2

3 years ago

0.47.1

3 years ago

0.47.0-36699

3 years ago

0.47.0

3 years ago

0.47.0-36362

3 years ago

0.46.1

3 years ago

0.47.0-35912

3 years ago

0.47.0-35961

3 years ago

0.46.0

3 years ago

0.46.0-34784

3 years ago

0.45.4

3 years ago

0.45.3

3 years ago

0.45.2

3 years ago

0.45.1

3 years ago

0.45.0-32948

3 years ago

0.45.0

3 years ago

0.44.1

3 years ago

0.39.8

3 years ago

0.44.0

3 years ago

0.39.7

3 years ago

0.44.0-30858

3 years ago

0.42.4

3 years ago

0.43.1

3 years ago

0.43.0

3 years ago

0.42.2

3 years ago

0.42.3

3 years ago

0.42.1

3 years ago

0.39.6

3 years ago

0.39.5

3 years ago

0.42.0

3 years ago

0.42.0-28410

3 years ago

0.41.3

3 years ago

0.41.4

3 years ago

0.41.2

3 years ago

0.42.0-27644

3 years ago

0.41.1

3 years ago

0.40.3

3 years ago

0.42.0-27549

3 years ago

0.42.0-27677

3 years ago

0.42.0-27683

3 years ago

0.40.2

3 years ago

0.40.0

3 years ago

0.41.0

3 years ago

0.40.1

3 years ago

0.41.0-27154

3 years ago

0.39.4

3 years ago

0.41.0-25957

3 years ago

0.39.1

4 years ago

0.38.2

4 years ago

0.39.0

4 years ago

0.38.1

4 years ago

0.39.3

4 years ago

0.38.4

4 years ago

0.39.2

4 years ago

0.38.3

4 years ago

0.39.0-23272

4 years ago

0.40.0-25851

3 years ago

0.40.0-25719

4 years ago

0.39.0-23254

4 years ago

0.38.0

4 years ago

0.38.0-22040

4 years ago

0.38.0-22000

4 years ago

0.38.0-21934

4 years ago

0.37.3-21287

4 years ago

0.37.4

4 years ago

0.37.3

4 years ago

0.37.2

4 years ago

0.37.1

4 years ago

0.37.0

4 years ago

0.37.0-20517

4 years ago

0.37.0-20427

4 years ago