-
Notifications
You must be signed in to change notification settings - Fork 532
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
Support rebasing ops for testing. Part 1, the mock. #16163
Conversation
// @public | ||
export class MockContainerRuntimeFactoryForRebasing extends MockContainerRuntimeFactory { | ||
// (undocumented) | ||
createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime, overrides?: { |
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.
just create() is good :)
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.
From MockContainerRuntimeFactory
export class MockContainerRuntimeFactoryForRebasing extends MockContainerRuntimeFactory { | ||
// (undocumented) | ||
createContainerRuntime(dataStoreRuntime: MockFluidDataStoreRuntime, overrides?: { | ||
minimumSequenceNumber?: number; |
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.
While I can see why you might want to create shape like that for last arg, I'd rather switch to this form when it's needed. Optional inside of optional is not great design pattern :)
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.
This is all existing code and I agree it can be refactored into a better shape. However, I don't believe this change should address that.
// (undocumented) | ||
processOneMessage(): void; | ||
// (undocumented) | ||
processSomeMessages(count: number): void; |
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.
Can you merge these 3 APIs into one? with count being optional (meaning all)?
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.
I think that's outside the scope of this change. These methods are coming from MockContainerRuntimeFactory
@@ -430,6 +435,17 @@ export class MockFluidDataStoreRuntime | |||
"fluid:MockFluidDataStoreRuntime", | |||
); | |||
public quorum = new MockQuorumClients(); | |||
public containerRuntime?: MockContainerRuntime; |
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.
I'd suggest we comment / document members as if it was public code. It's not very clear what is the purpose and semantics around this member.
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.
These are all part of the public API and currently undocumented.
@@ -430,6 +435,17 @@ export class MockFluidDataStoreRuntime | |||
"fluid:MockFluidDataStoreRuntime", | |||
); | |||
public quorum = new MockQuorumClients(); | |||
public containerRuntime?: MockContainerRuntime; | |||
private readonly deltaConnections: MockDeltaConnection[] = []; | |||
public createDeltaConnection?(): MockDeltaConnection { |
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.
Curious, why is it "?" ? I.e. it's actual implementation, it's not optional declaration.
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.
Back-compat. This is a public API so if it's not optional it will break back-compat (we'd need to do the whole typeValidation->broken
thing).
⯅ @fluid-example/bundle-size-tests: +230 Bytes
Baseline commit: dd316cf |
back to the drawing board with this, I believe it may be feasible to include this logic in the existing mock. |
public processAllMessages() { | ||
// Increase the sequence number between batches | ||
this.sequenceNumber++; | ||
this.processSomeMessages(this.messages.length); |
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.
This is wrong, we should evacuate the whole queue at this point (even if the queue grows while it's being evacuated).
Closing this in favor of #16460 |
Description
Adding a mock to support the new states added with #16176. This will be further integrated into the test pipeline via the fuzz testing harness.