Skip to content

Commit bc48362

Browse files
committed
B2B-2530: Unskip GraphQL cache tests skipped due to DEVOPS-4924
- Adjusted the comments as per review
1 parent eca98b8 commit bc48362

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/CacheTagTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public function testCacheInvalidationForProducts()
4040
}
4141
QUERY;
4242
// Cache should be a MISS when product is queried for first time
43-
// Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
4443
$response = $this->graphQlQueryWithResponseHeaders($query);
4544
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
45+
// Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
4646
$cacheId = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
47-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
47+
// Verify we obtain a cache MISS the first time
4848
$this->assertCacheMissAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
49-
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
49+
// Verify we obtain a cache HIT the second time
5050
$this->assertCacheHitAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
5151

5252
/** @var ProductRepositoryInterface $productRepository */
@@ -83,7 +83,7 @@ public function testCacheInvalidationForCategoriesWithProduct()
8383
// cache-debug header value should be a MISS when category is loaded first time
8484
$responseMissOnCategoryQuery = $this->graphQlQueryWithResponseHeaders($categoryQuery);
8585
$cacheIdOfCategoryQuery = $responseMissOnCategoryQuery['headers'][CacheIdCalculator::CACHE_ID_HEADER];
86-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
86+
// Verify we obtain a cache MISS the first time
8787
$this->assertCacheMissAndReturnResponse(
8888
$categoryQuery,
8989
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfCategoryQuery]
@@ -108,10 +108,10 @@ public function testCacheInvalidationForCategoriesWithProduct()
108108
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfSecondProduct]
109109
);
110110

111+
// cache-debug header value should be MISS after updating product1 and reloading the Category
111112
$firstProduct->setPrice(20);
112113
$productRepository->save($firstProduct);
113114

114-
// cache-debug header value should be MISS after updating product1 and reloading the Category
115115
// Verify we obtain a cache MISS after the first product update and category reloading
116116
$this->assertCacheMissAndReturnResponse(
117117
$categoryQuery,
@@ -126,7 +126,7 @@ public function testCacheInvalidationForCategoriesWithProduct()
126126
);
127127

128128
// Cache-debug header responses for product 2 and should be a HIT for product 2
129-
// Verify we obtain a cache HIT on the second product after updates
129+
// Verify we obtain a cache HIT on the second product after update
130130
$this->assertCacheHitAndReturnResponse(
131131
$product2Query,
132132
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfSecondProduct]

dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Cms/PageCacheTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public function testCacheIsUsedOnSecondRequest()
4545

4646
$query = $this->getPageQuery($pageId);
4747

48-
// Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
48+
4949
$response = $this->graphQlQueryWithResponseHeaders($query);
5050
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
51+
// Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
5152
$cacheId = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
5253
// Verify we obtain a cache MISS the first time
5354
$this->assertCacheMissAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
@@ -101,37 +102,44 @@ public function testCacheIsInvalidatedOnPageUpdate()
101102
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
102103
);
103104

104-
//cache-debug should be a HIT on second request
105+
//cache-debug should be a HIT on second request for page100 query
105106
$this->assertCacheHitAndReturnResponse(
106107
$page100Query,
107108
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPage100Response]
108109
);
109-
//cache-debug should be a HIT on second request
110+
//cache-debug should be a HIT on second request for page blank query
110111
$this->assertCacheHitAndReturnResponse(
111112
$pageBlankQuery,
112113
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
113114
);
114115

116+
//cache-debug should be a MISS after updating the blank page
115117
$pageRepository = Bootstrap::getObjectManager()->get(PageRepository::class);
116118
$newPageContent = 'New page content for blank page.';
117119
$pageBlank->setContent($newPageContent);
118120
$pageRepository->save($pageBlank);
119121

120-
//cache-debug should be a MISS after updating the page
122+
121123
$pageBlankResponseMissAfterUpdate = $this->graphQlQueryWithResponseHeaders($pageBlankQuery);
122-
// Verify we obtain a cache MISS after updating the page
124+
// Verify we obtain a cache MISS after updating the page blank query
123125
$this->assertCacheMissAndReturnResponse(
124126
$pageBlankQuery,
125127
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
126128
);
127129

130+
$pageBlankResponseHitAfterUpdate = $this->assertCacheHitAndReturnResponse(
131+
$pageBlankQuery,
132+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
133+
);
134+
135+
// Verify we obtain a cache Hit after updating the page on page 100 query
128136
$this->assertCacheHitAndReturnResponse(
129137
$page100Query,
130138
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPage100Response]
131139
);
132140

133-
//updated page data should be correct
134-
$this->assertNotEmpty($pageBlankResponseMissAfterUpdate['body']);
141+
//updated page data should be correct for blank page
142+
$this->assertNotEmpty($pageBlankResponseHitAfterUpdate['body']);
135143
$pageData = $pageBlankResponseMissAfterUpdate['body']['cmsPage'];
136144
$this->assertArrayNotHasKey('errors', $pageBlankResponseMissAfterUpdate['body']);
137145
$this->assertEquals('Cms Page Design Blank', $pageData['title']);

dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/UrlRewrite/UrlResolverCacheTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public function testCacheIsInvalidatedForUrlResolver()
143143
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForUrlResolver]
144144
);
145145

146+
//Updating the product url key
146147
/** @var ProductRepositoryInterface $productRepository */
147148
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
148149
/** @var Product $product */

0 commit comments

Comments
 (0)