Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter testing fails on the CLI but not in GitHub actions pull request automations #1069

Closed
palisadoes opened this issue Dec 22, 2021 · 2 comments · Fixed by #1165
Closed
Assignees
Labels
bug Something isn't working test Testing application

Comments

@palisadoes
Copy link
Contributor

Describe the bug

  1. The flutter test or flutter test --coverage commands fail on the CLI, but pass in the GitHub action testing.
  2. The sections that fail are below. Detailed output can be found later in the description
    00:04 +21 -1: loading /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/waiting_page_test.dart [E]        
      Failed to load "/home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/waiting_page_test.dart": lock failed, path = '/home/peter/Documents/currentuser.lock' (OS Error: Resource temporarily unavailable, errno = 11)
    
    and
    00:05 +33 -2: loading /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/set_url_page_test.dart [E]        
      Failed to load "/home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/set_url_page_test.dart": lock failed, path = '/home/peter/Documents/currentuser.lock' (OS Error: Resource temporarily unavailable, errno = 11)
    

The cause of the issue is related to using Hive as you can see in the detailed output below.

To Reproduce
Steps to reproduce the behavior:

  1. Run the command flutter test or flutter test --coverage

Expected behavior

  1. The command should execute with no errors on the CLI.
  2. The testing should continue to pass in the automated GitHub action when PRs are submitted.

Actual behavior
The command executes with the errors noted above. See below for detailed output.

Screenshots
If applicable, add screenshots to help explain your problem.

$ flutter test
00:03 +4: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in light mode Testing if Splash Screen shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +8: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in light mode Testing if app logo shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +9: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in light mode Testing if app name shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +11: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in light mode Testing if provider text shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +12: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in light mode Testing if provider name shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +13: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in dark mode Testing if Splash Screen shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +14: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in dark mode Testing if app logo shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +15: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in dark mode Testing if app name shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +16: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in dark mode Testing if provider text shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +19: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/splash_screen_test.dart: Splash Screen Widget Test in dark mode Testing if provider name shows up
safeBlockHorizontal: 8.0
safeBlockVertical: 6.0
00:04 +21 -1: loading /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/waiting_page_test.dart [E]        
  Failed to load "/home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/waiting_page_test.dart": lock failed, path = '/home/peter/Documents/currentuser.lock' (OS Error: Resource temporarily unavailable, errno = 11)
  package:hive/src/backend/vm/storage_backend_vm.dart 81:5                   StorageBackendVm.initialize
  ===== asynchronous gap ===========================
  package:hive/src/hive_impl.dart 111:9                                      HiveImpl._openBox
  ===== asynchronous gap ===========================
  package:hive/src/hive_impl.dart 139:12                                     HiveImpl.openBox
  ===== asynchronous gap ===========================
  test/widget_tests/pre_auth_screens/waiting_page_test.dart 70:3             main
  ===== asynchronous gap ===========================
  /tmp/flutter_tools.KHXFWW/flutter_test_listener.CVBZSE/listener.dart 19:3  _testMain
  
00:05 +24 -1: /home/peter/GitHub/talawa/test/widget_tests/home_page_test.dart: HomePage Widget Test Testing if Events Screen Shows up
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following MissingPluginException was thrown running a test (but after the test had completed):
MissingPluginException(No implementation found for method resync on channel razorpay_flutter)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following MissingPluginException was thrown running a test (but after the test had completed):
MissingPluginException(No implementation found for method resync on channel razorpay_flutter)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following MissingPluginException was thrown running a test (but after the test had completed):
MissingPluginException(No implementation found for method resync on channel razorpay_flutter)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
════════════════════════════════════════════════════════════════════════════════════════════════════
00:05 +31 -1: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/select_language_page_test.dart: Select Language Screen Widget Test in light mode Testing to change language items
0
Before Tap
After Tap
00:05 +33 -2: loading /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/set_url_page_test.dart [E]        
  Failed to load "/home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/set_url_page_test.dart": lock failed, path = '/home/peter/Documents/currentuser.lock' (OS Error: Resource temporarily unavailable, errno = 11)
  package:hive/src/backend/vm/storage_backend_vm.dart 81:5                   StorageBackendVm.initialize
  ===== asynchronous gap ===========================
  package:hive/src/hive_impl.dart 111:9                                      HiveImpl._openBox
  ===== asynchronous gap ===========================
  package:hive/src/hive_impl.dart 139:12                                     HiveImpl.openBox
  ===== asynchronous gap ===========================
  test/widget_tests/pre_auth_screens/set_url_page_test.dart 87:3             main
  ===== asynchronous gap ===========================
  /tmp/flutter_tools.KHXFWW/flutter_test_listener.JNXVJC/listener.dart 19:3  _testMain
  
00:06 +43 -2: /home/peter/GitHub/talawa/test/widget_tests/pre_auth_screens/select_language_page_test.dart: Select Language Screen Widget Test in dark mode Testing to change language items
ja
00:08 +47 -2: Some tests failed. 

Additional details
None

@palisadoes palisadoes added the bug Something isn't working label Dec 22, 2021
@github-actions github-actions bot added test Testing application unapproved Unapproved, needs to be triaged labels Dec 22, 2021
@palisadoes
Copy link
Contributor Author

@CyberWake Do you know why this is happening? The tests work in GitHub it seems, but not from the CLI.

@guptapriyanshu7
Copy link
Contributor

guptapriyanshu7 commented Jan 26, 2022

Flutter test is accessing some flles concurrently from the system managed by Hive which puts a lock when it is accessed by one test so that other tests cannot touch it. My speculation is that on Github actions there is only one thread on which all tests are running so this problem doesn't occur.
One workaround can be to make different files for Hive.
I would like to work on this.

@palisadoes palisadoes removed the unapproved Unapproved, needs to be triaged label Jan 26, 2022
Ayush0Chaudhary pushed a commit to Ayush0Chaudhary/talawa that referenced this issue Mar 29, 2023
…iles (PalisadoesFoundation#1069)

* addded constants for src/utilities files

* fixed test

* added test

---------

Co-authored-by: ashimawadhwa <ashima.wadhwa@rmgx.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test Testing application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants