Skip to content

Commit 4c85926

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

File tree

3 files changed

+7
-36
lines changed

3 files changed

+7
-36
lines changed

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

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ 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-
print_r("CacheId of CategoryQuery \n");
87-
print_r($cacheIdOfCategoryQuery);
8886
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
8987
$this->assertCacheMissAndReturnResponse(
9088
$categoryQuery,
@@ -114,39 +112,24 @@ public function testCacheInvalidationForCategoriesWithProduct()
114112
$productRepository->save($firstProduct);
115113

116114
// cache-debug header value should be MISS after updating product1 and reloading the Category
117-
$responseMissCategoryAfterProductUpdate = $this->graphQlQueryWithResponseHeaders($categoryQuery);
118-
$this->assertArrayHasKey(
119-
CacheIdCalculator::CACHE_ID_HEADER,
120-
$responseMissCategoryAfterProductUpdate['headers']
121-
);
122-
$cacheIdOfCategoryAfterProductUpdate =
123-
$responseMissCategoryAfterProductUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
124-
print_r("CacheId of CategoryQuery After update \n");
125-
print_r($cacheIdOfCategoryAfterProductUpdate );
126115
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
127116
$this->assertCacheMissAndReturnResponse(
128117
$categoryQuery,
129-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfCategoryAfterProductUpdate]
118+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfCategoryQuery]
130119
);
131120

132121
// cache-debug should be a MISS for product 1 after it is updated - cache invalidation
133-
$responseMissFirstProductAfterProductUpdate = $this->graphQlQueryWithResponseHeaders($product1Query);
134-
$cacheIdOfFirstProductAfterProductUpdate =
135-
$responseMissFirstProductAfterProductUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
136122
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
137123
$this->assertCacheMissAndReturnResponse(
138124
$product1Query,
139-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFirstProductAfterProductUpdate]
125+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFirstProduct]
140126
);
141127

142128
// Cache-debug header responses for product 2 and should be a HIT for product 2
143-
$responseHitSecondProduct = $this->graphQlQueryWithResponseHeaders($product2Query);
144-
$cacheIdOfSecondProductOnHit =
145-
$responseHitSecondProduct['headers'][CacheIdCalculator::CACHE_ID_HEADER];
146129
// Verify we obtain a cache HIT the second time around for this X-Magento-Cache-Id
147130
$this->assertCacheHitAndReturnResponse(
148131
$product2Query,
149-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfSecondProductOnHit]
132+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfSecondProduct]
150133
);
151134
}
152135

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,17 @@ 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-
$fixtureBlockAfterUpdate = $this->graphQlQueryWithResponseHeaders($fixtureBlockQuery);
102-
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $fixtureBlock['headers']);
103-
$cacheIdOfFixtureBlockAfterUpdate = $fixtureBlockAfterUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
104101
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
105102
$fixtureBlockHitResponse = $this->assertCacheMissAndReturnResponse(
106103
$fixtureBlockQuery,
107-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFixtureBlockAfterUpdate]
104+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfFixtureBlock]
108105
);
109106

110107
//cache-debug should be a HIT after update the block on enabled block query
111-
$enabledBlockAfterUpdate = $this->graphQlQueryWithResponseHeaders($enabledBlockQuery);
112-
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $enabledBlock['headers']);
113-
$cacheIdOfEnabledBlockAfterUpdate = $enabledBlockAfterUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
114108
// Verify we obtain a cache HIT the second time we search the cache using this X-Magento-Cache-Id
115109
$this->assertCacheHitAndReturnResponse(
116110
$enabledBlockQuery,
117-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfEnabledBlockAfterUpdate]
111+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdOfEnabledBlock]
118112
);
119113

120114
//updated block data should be correct on fixture block

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,16 @@ public function testCacheIsInvalidatedOnPageUpdate()
119119

120120
//cache-debug should be a MISS after updating the page
121121
$pageBlankResponseMissAfterUpdate = $this->graphQlQueryWithResponseHeaders($pageBlankQuery);
122-
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $pageBlankResponseMissAfterUpdate['headers']);
123-
$cacheIdPageBlankResponseMissAfterUpdate =
124-
$pageBlankResponseMissAfterUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
125122
// Verify we obtain a cache MISS the first time we search the cache using this X-Magento-Cache-Id
126123
$this->assertCacheMissAndReturnResponse(
127124
$pageBlankQuery,
128-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponseMissAfterUpdate]
125+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPageBlankResponse]
129126
);
130127

131128
$page100ResponseHitAfterUpdate = $this->graphQlQueryWithResponseHeaders($page100Query);
132-
$this->assertArrayHasKey(CacheIdCalculator::CACHE_ID_HEADER, $page100ResponseHitAfterUpdate['headers']);
133-
$cacheIdPage100ResponseHitAfterUpdate =
134-
$page100ResponseHitAfterUpdate['headers'][CacheIdCalculator::CACHE_ID_HEADER];
135129
$this->assertCacheHitAndReturnResponse(
136130
$page100Query,
137-
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPage100ResponseHitAfterUpdate]
131+
[CacheIdCalculator::CACHE_ID_HEADER => $cacheIdPage100Response]
138132
);
139133

140134
//updated page data should be correct

0 commit comments

Comments
 (0)