-
Notifications
You must be signed in to change notification settings - Fork 554
Fix broken TinyliciousClient test and ensure tinylicious tests run in CI #25344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
038c532
62a4fe5
801577f
dae75da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,8 +5,6 @@ | |||||
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||||||
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||||||
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||||||
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||||||
|
@@ -30,32 +28,26 @@ import { TinyliciousClient } from "../index.js"; | |||||
|
||||||
import { TestDataObject } from "./TestDataObject.js"; | ||||||
|
||||||
const corruptedAliasOp = async ( | ||||||
runtime: IContainerRuntime, | ||||||
alias: string, | ||||||
): Promise<boolean | Error> => | ||||||
new Promise<boolean>((resolve, reject) => { | ||||||
runtime.once("dispose", () => reject(new Error("Runtime disposed"))); | ||||||
(runtime as any).submit(ContainerMessageType.Alias, { id: alias }, resolve); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
}).catch((error) => new Error(error.message)); | ||||||
const corruptedAliasOp = (runtime: IContainerRuntime, alias: string): void => { | ||||||
(runtime as any).submit({ type: ContainerMessageType.Alias, contents: { id: alias } }); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The submit method call appears to be using an incorrect API signature. The original code used separate parameters for message type and contents, but this change combines them into a single object. Verify this matches the expected IContainerRuntime.submit API signature.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one of the ways in which the test was broken, which changed in #16276 |
||||||
}; | ||||||
|
||||||
const runtimeOf = (dataObject: TestDataObject): IContainerRuntime => | ||||||
(dataObject as any).context.containerRuntime as IContainerRuntime; | ||||||
|
||||||
const connectionModeOf = (container: IFluidContainer): ConnectionMode => | ||||||
(container as any).container.connectionMode as ConnectionMode; | ||||||
|
||||||
const allDataCorruption = async (containers: IFluidContainer[]): Promise<boolean> => | ||||||
Promise.all( | ||||||
containers.map( | ||||||
async (c) => | ||||||
new Promise<boolean>((resolve) => | ||||||
c.once("disposed", (error) => { | ||||||
resolve(error?.errorType === ContainerErrorTypes.dataCorruptionError); | ||||||
}), | ||||||
), | ||||||
), | ||||||
).then((all) => !all.includes(false)); | ||||||
const waitForDataCorruption = async (container: IFluidContainer): Promise<void> => | ||||||
new Promise<void>((resolve, reject) => | ||||||
container.once("disposed", (error) => { | ||||||
if (error?.errorType === ContainerErrorTypes.dataCorruptionError) { | ||||||
resolve(); | ||||||
} else { | ||||||
reject(error); | ||||||
} | ||||||
}), | ||||||
); | ||||||
|
||||||
for (const compatibilityMode of ["1", "2"] as const) { | ||||||
describe(`TinyliciousClient (compatibilityMode: ${compatibilityMode})`, function () { | ||||||
|
@@ -362,9 +354,11 @@ for (const compatibilityMode of ["1", "2"] as const) { | |||||
}); | ||||||
|
||||||
const do1 = createFluidContainer.initialObjects.do1; | ||||||
const dataCorruption = allDataCorruption([createFluidContainer]); | ||||||
await corruptedAliasOp(runtimeOf(do1), "alias"); | ||||||
assert(await dataCorruption); | ||||||
const dataCorruptionP = waitForDataCorruption(createFluidContainer); | ||||||
corruptedAliasOp(runtimeOf(do1), "alias"); | ||||||
// dataCorruptionP resolves if the container disposes with the expected error, rejects | ||||||
// if it disposes with any other error. | ||||||
await dataCorruptionP; | ||||||
}); | ||||||
|
||||||
/** | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without
--exit
, the tests hang at completion. This implies something isn't getting cleaned up so it's not great, but this at least gets the tests running again.