Skip to content
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

Loosen state check #18003

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -938,7 +940,15 @@ void testSyncAfterUpgradeToPerStreamState(final TestInfo testInfo) throws Except
assertEquals(1, state.getStreamState().size());
final StreamState idAndNameState = state.getStreamState().get(0);
assertEquals(new StreamDescriptor().namespace(PUBLIC).name(STREAM_NAME), idAndNameState.getStreamDescriptor());
assertEquals(Jsons.deserialize(expectedState), idAndNameState.getStreamState());
assertStateContains(Jsons.deserialize(expectedState), idAndNameState.getStreamState());
}

// Verify that actual contains expected all the (key, value) from expected.
private void assertStateContains(final JsonNode expected, final JsonNode actual) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we allow extra.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's merge it to unlock Michael but we should revisit and also make sure that the platform is buildfor any change to the PG connectors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#15535 add new fields to the state, if possible, it would be nice to not have a hard check on the exact content of the state in the platform.

for (Iterator<Entry<String, JsonNode>> it = expected.fields(); it.hasNext();) {
Entry<String, JsonNode> e = it.next();
assertEquals(e.getValue(), actual.get(e.getKey()));
}
}

@Test
Expand Down