Skip to content

Commit

Permalink
Re-enable back-compat testing for compression (microsoft#13624)
Browse files Browse the repository at this point in the history
## Description

ADO:2942

They have been disabled initially because the new runtime:
- [sends the compression message field to the
loader](https://github.com/microsoft/FluidFramework/blob/65a7a49c82caa09e8af9a6473a5802096f861e66/packages/runtime/container-runtime/src/opLifecycle/outbox.ts#L193)
- does not send or check the metadata compression field anymore

therefore, new runtimes will not be able to process the old compressed
batches as they won't have the message-level compression field and the
metadata compression field is ignored.

The PR tests are expected to fail until a new version is released.
Afterwards, it will be merged.
  • Loading branch information
andre4i committed Feb 1, 2023
1 parent 21ae44b commit f631138
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 38 deletions.
64 changes: 29 additions & 35 deletions packages/test/test-end-to-end-tests/src/test/blobs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,35 @@ describeFullCompat("blobs", (getTestObjectProvider) => {
dataStore._runtime.uploadBlob(blob),
]);
});

it("attach sends an op with compression enabled", async function () {
const container = await provider.makeTestContainer({
...testContainerConfig,
runtimeOptions: {
...testContainerConfig.runtimeOptions,
compressionOptions: {
minimumBatchSizeInBytes: 1,
compressionAlgorithm: CompressionAlgorithms.lz4,
},
},
});

const dataStore = await requestFluidObject<ITestDataObject>(container, "default");
const blobOpP = new Promise<void>((resolve, reject) =>
dataStore._context.containerRuntime.on("op", (op) => {
if (op.type === ContainerMessageType.BlobAttach) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
op.metadata?.blobId ? resolve() : reject(new Error("no op metadata"));
}
}),
);

const blob = await dataStore._runtime.uploadBlob(
stringToBuffer("some random text", "utf-8"),
);
dataStore._root.set("my blob", blob);
await blobOpP;
});
});

// this functionality was added in 0.47 and can be added to the compat-enabled
Expand Down Expand Up @@ -533,39 +562,4 @@ describeNoCompat("blobs", (getTestObjectProvider) => {
provider.opProcessingController.resumeProcessing();
await uploadP;
});

// Add this test to full compat ADO: 2942
it("attach sends an op with compression enabled", async function () {
// ADO:3113
if (provider.driver.type === "tinylicious") {
this.skip();
}

const container = await provider.makeTestContainer({
...testContainerConfig,
runtimeOptions: {
...testContainerConfig.runtimeOptions,
compressionOptions: {
minimumBatchSizeInBytes: 1,
compressionAlgorithm: CompressionAlgorithms.lz4,
},
},
});

const dataStore = await requestFluidObject<ITestDataObject>(container, "default");
const blobOpP = new Promise<void>((resolve, reject) =>
dataStore._context.containerRuntime.on("op", (op) => {
if (op.type === ContainerMessageType.BlobAttach) {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
op.metadata?.blobId ? resolve() : reject(new Error("no op metadata"));
}
}),
);

const blob = await dataStore._runtime.uploadBlob(
stringToBuffer("some random text", "utf-8"),
);
dataStore._root.set("my blob", blob);
await blobOpP;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ITestFluidObject,
ITestObjectProvider,
} from "@fluidframework/test-utils";
import { describeNoCompat } from "@fluidframework/test-version-utils";
import { describeFullCompat } from "@fluidframework/test-version-utils";
import { CompressionAlgorithms } from "@fluidframework/container-runtime";

const testContainerConfig: ITestContainerConfig = {
Expand All @@ -27,8 +27,7 @@ const testContainerConfig: ITestContainerConfig = {
fluidDataObjectType: DataObjectFactoryType.Test,
};

// Reenable full compat ADO:2942
describeNoCompat("Op Compression", (getTestObjectProvider) => {
describeFullCompat("Op Compression", (getTestObjectProvider) => {
let provider: ITestObjectProvider;
let container: Container;
let dataObject: ITestFluidObject;
Expand Down

0 comments on commit f631138

Please sign in to comment.