Firebase-tools: محاكي Firestore في حالة توقف تام في المعاملة

تم إنشاؤها على ١٣ يوليو ٢٠٢٠  ·  6تعليقات  ·  مصدر: firebase/firebase-tools

لا تحذف Validate_template = true template_path = .github / ISSUE_TEMPLATE / bug_report.md

معلومات البيئة

أدوات Firebase
النظام الأساسي: macOS
العقدة: 10.21.0

حالة اختبار

عند القراءة / الكتابة إلى مستند باستخدام معاملتين متزامنتين ، تتوقف المعاملات (كما لو كانت في طريق مسدود).

لقد أضفت بعض التعليمات البرمجية لتوضيح المشكلة (بما في ذلك بعض سجلات وحدة التحكم لتوضيح مكان تعليق الرمز).

firestore-emulator-bug-showcase.zip

خطوات التكاثر

بعد تنزيل نموذج التعليمات البرمجية ، قم بتشغيل:

npm install
firebase emulators:start --only firestore --debug # Assuming to be at version 8.5.0

أثناء تشغيل المحاكي ، قم بتشغيل الأمر التالي في محطة مختلفة:

npm run test

سلوك متوقع

أتوقع تشغيل جميع الاختبارات بنجاح. هذا يعنى:

  • يتم تشغيل اختبار "firestore" بنجاح.
  • في اختبار "التأجير الفردي" يتم إرجاع true .
  • في اختبار "lease multi" ، تُرجع إحدى المعاملات true بينما تُرجع المعاملة الأخرى false .

السلوك الفعلي

ولكن في الواقع ، فإن اختبار "عقد الإيجار المتعدد" معلق وينتهي المهلة. يعمل الاختباران "firestore" و "lease single" كما هو متوقع.

انظر الإخراج أدناه:

إخراج الدعابة:

> jest

PASS src/firestore.spec.ts
  firestore
    ✓ is able to communicate with emulator (1063 ms)


  console.info
    Before transaction: try to acquire lease in transaction ...

      at acquireLease (src/lease.ts:16:11)

  console.info
    Before transaction: try to acquire lease in transaction ...

      at acquireLease (src/lease.ts:16:11)

  console.info
    Before transaction: try to acquire lease in transaction ...

      at acquireLease (src/lease.ts:16:11)

PASS src/lease.single.spec.ts
  acquireLease single
    ✓ returns true when ran once (1040 ms)

  console.info
    Transaction: acquired a new lease

      at _firestore2.firestore.runTransaction (src/lease.ts:37:15)

  console.info
    Transaction: acquired a new lease

      at _firestore2.firestore.runTransaction (src/lease.ts:37:15)

  console.info
    Transaction: acquired a new lease

      at _firestore2.firestore.runTransaction (src/lease.ts:37:15)

  console.info
    After transaction: will return true

      at acquireLease (src/lease.ts:43:11)

FAIL src/lease.multi.spec.ts
  ● Test suite failed to run

    Timeout - Async callback was not invoked within the 15000 ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 15000 ms timeout specified by jest.setTimeout.

      at mapper (node_modules/jest-jasmine2/build/queueRunner.js:29:45)

A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --runInBand --detectOpenHandles to find leaks.
Test Suites: 1 failed, 2 passed, 3 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        32.386 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ test: `jest`
npm ERR! Exit status 1

إخراج المحاكي:

[2020-07-13T15:28:34.365Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-07-13T15:28:34.366Z] > authorizing via signed-in user
⚠  Could not find config (firebase.json) so using defaults. 
i  emulators: Starting emulators: firestore {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: firestore"}}
⚠  firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file. {"metadata":{"emulator":{"name":"firestore"},"message":"Did not find a Cloud Firestore rules file specified in a firebase.json config file."}}
⚠  firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration. {"metadata":{"emulator":{"name":"firestore"},"message":"The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration."}}
[2020-07-13T15:28:34.384Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: projectId"}}
[2020-07-13T15:28:34.384Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"firestore"},"message":"Ignoring unsupported arg: auto_download"}}
[2020-07-13T15:28:34.385Z] Starting Firestore Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/vdvleon/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.4.jar","--host","localhost","--port",8080],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false} {"metadata":{"emulator":{"name":"firestore"},"message":"Starting Firestore Emulator with command {\"binary\":\"java\",\"args\":[\"-Duser.language=en\",\"-jar\",\"/Users/vdvleon/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.4.jar\",\"--host\",\"localhost\",\"--port\",8080],\"optionalArgs\":[\"port\",\"webchannel_port\",\"host\",\"rules\",\"functions_emulator\",\"seed_from_export\"],\"joinArgs\":false}"}}
i  firestore: Firestore Emulator logging to firestore-debug.log {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m"}}
[2020-07-13T15:28:35.488Z] API endpoint: http://localhost {"metadata":{"emulator":{"name":"firestore"},"message":"API endpoint: http://localhost"}}
[2020-07-13T15:28:35.488Z] :8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=localhost:8080

Dev App Server is now running.

 {"metadata":{"emulator":{"name":"firestore"},"message":":8080\nIf you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:\n\n   export FIRESTORE_EMULATOR_HOST=localhost:8080\n\nDev App Server is now running.\n\n"}}

┌──────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your apps. │
└──────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┐
│ Emulator  │ Host:Port      │
├───────────┼────────────────┤
│ Firestore │ localhost:8080 │
└───────────┴────────────────┘
  Other reserved ports: 

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.

[2020-07-13T15:28:53.466Z] Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n"}}
[2020-07-13T15:28:53.466Z] Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n"}}
[2020-07-13T15:28:53.466Z] Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 13, 2020 5:28:53 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n"}}
[2020-07-13T15:29:24.261Z] Jul 13, 2020 5:29:24 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: transaction timeout
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 13, 2020 5:29:24 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError\nINFO: operation failed: transaction timeout\n"}}
[2020-07-13T15:29:24.261Z] Jul 13, 2020 5:29:24 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: transaction timeout
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 13, 2020 5:29:24 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError\nINFO: operation failed: transaction timeout\n"}}
emulator-suite firestore internal-bug-filed

التعليق الأكثر فائدة

أي تحديث على أنrosalyntansamtstern؟ إنه أمر بالغ الأهمية لأنه يجعل محاكي Firestore غير قابل للاستخدام في أي اختبارات تكامل باستخدام المعاملات. شكر!

ال 6 كومينتر

@ vdvleon أشكرك على الاستنساخ ، لقد تمكنت من رؤية نفس النتيجة. التعيين إلى

أتساءل ما إذا كان هناك تقدم في هذه القضية؟ يبدو أنه منذ حوالي عام حدثت المشكلة أيضًا. ربما هذا مرتبط؟

شكرا لتقديم هذه القضية! قدم ب / 162265825 للتعقب الداخلي.

ذات صلة؟

يمكن أن تكون مرتبطة نعم. هل يمكن تغيير هذا السلوك أم أن هناك طريقة للتأثير في هذه المهلة؟ ليس من الواقعي ترك اختباراتنا تنتظر لمدة 30 ثانية.

أي تحديث على أنrosalyntansamtstern؟ إنه أمر بالغ الأهمية لأنه يجعل محاكي Firestore غير قابل للاستخدام في أي اختبارات تكامل باستخدام المعاملات. شكر!

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات