如何修复gitlab-ci中的“ sqlite3.OperationalError:无法打开数据库文件”错误?

时间:2019-10-28 09:32:10

标签: docker google-app-engine testing gitlab-ci

当我尝试在gitlab-ci中运行某些google-app-engine go test命令时,所有测试都会失败。

我已经在本地计算机和本地docker容器中执行了这些测试,它们运行良好。但是他们在gitlab-ci中失败了。我认为这是由于gitlab运行程序内部的数据存储文件权限引起的,但是我不知道如何解决它们,因为我需要访问gitlab容器!随附了gitlab-ci配置和错误消息,供您调查。

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

我希望通过测试,但是上面的错误消息将显示在日志中。

0 个答案:

没有答案