Procházet zdrojové kódy

test: Attempt to proof search plugin tests against race conditions

Michael Bromley před 4 roky
rodič
revize
7b991691a7

+ 4 - 6
packages/core/e2e/default-search-plugin.e2e-spec.ts

@@ -91,7 +91,6 @@ interface SearchProductShopVariables extends SearchProductsShop.Variables {
 describe('Default search plugin', () => {
     const { server, adminClient, shopClient } = createTestEnvironment(
         mergeConfig(testConfig(), {
-            logger: new DefaultLogger(),
             plugins: [DefaultSearchPlugin.init({ indexStockStatus: true }), DefaultJobQueuePlugin],
         }),
     );
@@ -103,11 +102,10 @@ describe('Default search plugin', () => {
             customerCount: 1,
         });
         await adminClient.asSuperAdmin();
-        if (testConfig().dbConnectionOptions.type === 'mysql') {
-            // Mysql seems to occasionally run into some kind of race condition
-            // relating to the populating of data, so we add a pause here.
-            await new Promise(resolve => setTimeout(resolve, 10000));
-        }
+
+        // A precaution against a race condition in which the index
+        // rebuild is not completed in time for the first test.
+        await new Promise(resolve => setTimeout(resolve, 5000));
     }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {

+ 0 - 1
packages/elasticsearch-plugin/e2e/elasticsearch-plugin.e2e-spec.ts

@@ -115,7 +115,6 @@ const INDEX_PREFIX = 'e2e-tests';
 describe('Elasticsearch plugin', () => {
     const { server, adminClient, shopClient } = createTestEnvironment(
         mergeConfig(testConfig(), {
-            logger: new DefaultLogger({ level: LogLevel.Info }),
             plugins: [
                 ElasticsearchPlugin.init({
                     indexPrefix: INDEX_PREFIX,