lundi 28 octobre 2019

How to fix 'sqlite3.OperationalError: unable to open database file' error in gitlab-ci?

When I try to run some google-app-engine go test command inside gitlab-ci all tests will fail.

I've executed these tests inside either my local machine and local docker container and they worked fine. But they are failing in gitlab-ci. I think that this happening because of datastore file permissions inside gitlab runners, but i don't know how to fix them because I need to access the gitlab containers! gitlab-ci configurations and error message has been attached for your investigations.

variables:
  GO_PROJECT: github.com/auteurly

stages:
  - test

go_test:
  image: mercari/appengine-go:latest

  before_script:
    - mkdir -p ${GOPATH}/src/${GO_PROJECT}
    - cp -r ${CI_PROJECT_DIR}/* ${GOPATH}/src/${GO_PROJECT}/
    - go get -v github.com/auteurly/...
    - cd ${GOPATH}/src/${GO_PROJECT}/app_engine/

  stage: test
  script:
    - go test
INFO     2019-10-28 08:48:58,201 devappserver2.py:278] Skipping SDK update check.
WARNING  2019-10-28 08:48:58,201 devappserver2.py:294] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 96, in <module>
    _run_file(__file__, globals())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 90, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 600, in <module>
    main()
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 588, in main
    dev_server.start(options)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 355, in start
    configuration.modules[0].application_root)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 654, in create_api_server
    if options.support_datastore_emulator else None)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/stub_util.py", line 201, in setup_stubs
    consistency_policy=datastore_consistency))
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_sqlite_stub.py", line 618, in __init__
    factory=sql_conn)
sqlite3.OperationalError: unable to open database file
INFO     2019-10-28 08:49:13,271 devappserver2.py:278] Skipping SDK update check.
WARNING  2019-10-28 08:49:13,271 devappserver2.py:294] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 96, in <module>
    _run_file(__file__, globals())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 90, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 600, in <module>
    main()
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 588, in main
    dev_server.start(options)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 355, in start
    configuration.modules[0].application_root)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 654, in create_api_server
    if options.support_datastore_emulator else None)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/stub_util.py", line 201, in setup_stubs
    consistency_policy=datastore_consistency))
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/datastore/datastore_sqlite_stub.py", line 618, in __init__
    factory=sql_conn)
sqlite3.OperationalError: unable to open database file

I expect to PASS the tests but the above error message will show up in logs.

Aucun commentaire:

Enregistrer un commentaire