Skip to content

Commit a8a846e

Browse files
debug: using uuid on tests
1 parent dffe54d commit a8a846e

File tree

1 file changed

+19
-0
lines changed
  • src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/categories

1 file changed

+19
-0
lines changed

src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/categories/CategorySyncIT.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,25 @@ void syncDrafts_fromCategoriesWithoutKeys_ShouldNotUpdateCategories() {
504504
assertThat(targetCat2).isNotNull();
505505
assertThat(targetCat2.getSlug().get(Locale.ENGLISH)).isEqualTo(slug2);
506506

507+
// Re-fetch TARGET categories by slug to ensure they're fully indexed before syncing
508+
// This addresses potential eventual consistency issues with the commercetools API
509+
final long targetCategoriesWithOurSlugs =
510+
TestClientUtils.CTP_TARGET_CLIENT
511+
.categories()
512+
.get()
513+
.withWhere("slug(en in :slugs)")
514+
.withPredicateVar("slugs", List.of(slug1, slug2))
515+
.execute()
516+
.toCompletableFuture()
517+
.join()
518+
.getBody()
519+
.getTotal();
520+
assertThat(targetCategoriesWithOurSlugs)
521+
.withFailMessage(
522+
"Expected 2 categories with slugs %s and %s in TARGET, but found %d",
523+
slug1, slug2, targetCategoriesWithOurSlugs)
524+
.isEqualTo(2L);
525+
507526
// ---------
508527

509528
// Fetch only the categories we created for this test (by keys)

0 commit comments

Comments
 (0)