Skip to content

Commit 604c02b

Browse files
committed
B2B-2530: Unskip GraphQL cache tests skipped due to DEVOPS-4924
- Added fixes on comments
1 parent 4c85926 commit 604c02b

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testCacheInvalidationForCategoriesWithProduct()
9393
$responseFirstProduct = $this->graphQlQueryWithResponseHeaders($product1Query);
9494
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $responseFirstProduct['headers']);
9595
$cacheIdOfFirstProduct = $responseFirstProduct['headers'][CacheIdCalculator::CACHE_ID_HEADER];
96-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
96+
// Verify we obtain a cache MISS on the first product
9797
$this->assertCacheMissAndReturnResponse(
9898
$product1Query,
9999
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFirstProduct]
@@ -112,21 +112,21 @@ public function testCacheInvalidationForCategoriesWithProduct()
112112
$productRepository->save($firstProduct);
113113

114114
// cache-debug header value should be MISS after updating product1 and reloading the Category
115-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
115+
// Verify we obtain a cache MISS after the first product update and category reloading
116116
$this->assertCacheMissAndReturnResponse(
117117
$categoryQuery,
118118
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfCategoryQuery]
119119
);
120120

121121
// cache-debug should be a MISS for product 1 after it is updated - cache invalidation
122-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
122+
// Verify we obtain a cache MISS after the first product update
123123
$this->assertCacheMissAndReturnResponse(
124124
$product1Query,
125125
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFirstProduct]
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 the second time around for this X-Magento-Cache-Id
129+
// Verify we obtain a cache HIT on the second product after updates
130130
$this->assertCacheHitAndReturnResponse(
131131
$product2Query,
132132
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfSecondProduct]

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testCacheIsInvalidatedOnBlockUpdate()
6767
$fixtureBlock = $this->graphQlQueryWithResponseHeaders($fixtureBlockQuery);
6868
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $fixtureBlock['headers']);
6969
$cacheIdOfFixtureBlock = $fixtureBlock['headers'][CacheIdCalculator::CACHE_ID_HEADER];
70-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
70+
// Verify we obtain a cache MISS the first time
7171
$this->assertCacheMissAndReturnResponse(
7272
$fixtureBlockQuery,
7373
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFixtureBlock]
@@ -76,19 +76,19 @@ public function testCacheIsInvalidatedOnBlockUpdate()
7676
$enabledBlock = $this->graphQlQueryWithResponseHeaders($enabledBlockQuery);
7777
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $enabledBlock['headers']);
7878
$cacheIdOfEnabledBlock = $enabledBlock['headers'][CacheIdCalculator::CACHE_ID_HEADER];
79-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
79+
// Verify we obtain a cache MISS the first time
8080
$this->assertCacheMissAndReturnResponse(
8181
$enabledBlockQuery,
8282
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfEnabledBlock]
8383
);
8484

8585
//cache should be a HIT on second request
86-
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
86+
// Verify we obtain a cache HIT the second time
8787
$this->assertCacheHitAndReturnResponse(
8888
$fixtureBlockQuery,
8989
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFixtureBlock]
9090
);
91-
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
91+
// Verify we obtain a cache HIT the second time
9292
$this->assertCacheHitAndReturnResponse(
9393
$enabledBlockQuery,
9494
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfEnabledBlock]
@@ -98,14 +98,14 @@ public function testCacheIsInvalidatedOnBlockUpdate()
9898
$this->updateBlockContent($fixtureBlockIdentifier, $newBlockContent);
9999

100100
//cache-debug should be a MISS after update the block on fixture block query
101-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
101+
// Verify we obtain a cache MISS the first time after update on the fixture block
102102
$fixtureBlockHitResponse = $this->assertCacheMissAndReturnResponse(
103103
$fixtureBlockQuery,
104104
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFixtureBlock]
105105
);
106106

107107
//cache-debug should be a HIT after update the block on enabled block query
108-
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
108+
// Verify we obtain a cache HIT the second time on the updated enabled block
109109
$this->assertCacheHitAndReturnResponse(
110110
$enabledBlockQuery,
111111
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfEnabledBlock]

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function testCacheIsUsedOnSecondRequest()
4949
$response = $this->graphQlQueryWithResponseHeaders($query);
5050
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
5151
$cacheId = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
52-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
52+
// Verify we obtain a cache MISS the first time
5353
$this->assertCacheMissAndReturnResponse($query, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
54-
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
54+
// Verify we obtain a cache HIT the second time
5555
$responseHit = $this->assertCacheHitAndReturnResponse(
5656
$query,
5757
[CacheIdCalculator::CACHE_ID_HEADER => $cacheId]
@@ -86,7 +86,7 @@ public function testCacheIsInvalidatedOnPageUpdate()
8686
$page100Response = $this->graphQlQueryWithResponseHeaders($page100Query);
8787
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $page100Response['headers']);
8888
$cacheIdPage100Response = $page100Response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
89-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
89+
// Verify we obtain a cache MISS the first time
9090
$this->assertCacheMissAndReturnResponse(
9191
$page100Query,
9292
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPage100Response]
@@ -95,7 +95,7 @@ public function testCacheIsInvalidatedOnPageUpdate()
9595
$pageBlankResponse = $this->graphQlQueryWithResponseHeaders($pageBlankQuery);
9696
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $pageBlankResponse['headers']);
9797
$cacheIdPageBlankResponse = $pageBlankResponse['headers'][CacheIdCalculator::CACHE_ID_HEADER];
98-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
98+
// Verify we obtain a cache MISS the first time
9999
$this->assertCacheMissAndReturnResponse(
100100
$pageBlankQuery,
101101
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
@@ -119,7 +119,7 @@ public function testCacheIsInvalidatedOnPageUpdate()
119119

120120
//cache-debug should be a MISS after updating the page
121121
$pageBlankResponseMissAfterUpdate = $this->graphQlQueryWithResponseHeaders($pageBlankQuery);
122-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
122+
// Verify we obtain a cache MISS after updating the page
123123
$this->assertCacheMissAndReturnResponse(
124124
$pageBlankQuery,
125125
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]

dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Quote/Guest/CartCacheTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ public function testCartIsNotCached()
3535
$this->assertArrayHasKey('items', $responseMiss['body']['cart']);
3636
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $responseMiss['headers']);
3737
$cacheId = $responseMiss['headers'][CacheIdCalculator::CACHE_ID_HEADER];
38-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
38+
// Verify we obtain a cache MISS the first time
3939
$this->assertCacheMissAndReturnResponse($getCartQuery, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
4040

4141
// Cache debug header value is still a MISS for any subsequent request
42-
// Obtain the X-Magento-Cache-Id from the response which will be used as the cache key
43-
// Verify we obtain a cache MISS the second time we search the cache using this X-Magento-Cache-Id
42+
// Verify we obtain a cache MISS the second time
4443
$this->assertCacheMissAndReturnResponse($getCartQuery, [CacheIdCalculator::CACHE_ID_HEADER => $cacheId]);
4544
}
4645

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public function testUrlResolverCachingForProducts()
3333
$response = $this->graphQlQueryWithResponseHeaders($urlResolverQuery);
3434
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
3535
$cacheIdForProducts = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
36-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
36+
// Verify we obtain a cache MISS the first time
3737
$this->assertCacheMissAndReturnResponse(
3838
$urlResolverQuery,
3939
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForProducts]
4040
);
41-
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
41+
// Verify we obtain a cache HIT the second time
4242
$cachedResponse = $this->assertCacheHitAndReturnResponse(
4343
$urlResolverQuery,
4444
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForProducts]
@@ -64,12 +64,12 @@ public function testUrlResolverCachingForCategory()
6464
$response = $this->graphQlQueryWithResponseHeaders($query);
6565
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
6666
$cacheIdForCategory = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
67-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
67+
// Verify we obtain a cache MISS the first time
6868
$this->assertCacheMissAndReturnResponse(
6969
$query,
7070
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForCategory]
7171
);
72-
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
72+
// Verify we obtain a cache HIT the second time
7373
$cachedResponse = $this->assertCacheHitAndReturnResponse(
7474
$query,
7575
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForCategory]
@@ -98,12 +98,12 @@ public function testUrlResolverCachingForCMSPage()
9898
$response = $this->graphQlQueryWithResponseHeaders($query);
9999
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
100100
$cacheIdForCmsPage = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
101-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
101+
// Verify we obtain a cache MISS the first time
102102
$this->assertCacheMissAndReturnResponse(
103103
$query,
104104
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForCmsPage]
105105
);
106-
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
106+
// Verify we obtain a cache HIT the second time
107107
$cachedResponse = $this->assertCacheHitAndReturnResponse(
108108
$query,
109109
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForCmsPage]
@@ -132,12 +132,12 @@ public function testCacheIsInvalidatedForUrlResolver()
132132
$response = $this->graphQlQueryWithResponseHeaders($urlResolverQuery);
133133
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $response['headers']);
134134
$cacheIdForUrlResolver = $response['headers'][CacheIdCalculator::CACHE_ID_HEADER];
135-
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
135+
// Verify we obtain a cache MISS the first time
136136
$this->assertCacheMissAndReturnResponse(
137137
$urlResolverQuery,
138138
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForUrlResolver]
139139
);
140-
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
140+
// Verify we obtain a cache HIT the second time
141141
$this->assertCacheHitAndReturnResponse(
142142
$urlResolverQuery,
143143
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdForUrlResolver]

0 commit comments

Comments
 (0)