From b5815c7689d47d030940c3aa0faa1e543703d0fc Mon Sep 17 00:00:00 2001 From: Jimmy Ma Date: Fri, 14 Oct 2022 10:48:02 -0700 Subject: [PATCH] Loosen state check --- .../test/acceptance/BasicAcceptanceTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/airbyte-tests/src/acceptanceTests/java/io/airbyte/test/acceptance/BasicAcceptanceTests.java b/airbyte-tests/src/acceptanceTests/java/io/airbyte/test/acceptance/BasicAcceptanceTests.java index 8dcb24e7064a..c4385891d2dd 100644 --- a/airbyte-tests/src/acceptanceTests/java/io/airbyte/test/acceptance/BasicAcceptanceTests.java +++ b/airbyte-tests/src/acceptanceTests/java/io/airbyte/test/acceptance/BasicAcceptanceTests.java @@ -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; @@ -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) { + for (Iterator> it = expected.fields(); it.hasNext();) { + Entry e = it.next(); + assertEquals(e.getValue(), actual.get(e.getKey())); + } } @Test