java代码输出伞_在伞中集成测试Web应用程序的问题
我正在研究鳳凰應用程序 . 此應用程序是傘形應用程序的一部分 . 在這個保護傘中,我有一些小應用程序負責應用程序的不同區域,它們是:
phoenix web api("api")
核心業務邏輯("core")
用戶身份驗證("auth")
數據庫架構("db")
“api”依賴于“core”和“auth”,而這兩個應用程序依賴于“db” .
只有“db”應用程序有一個ecto repo,所有其他應用程序都沒有 . 回購由“db”應用程序啟動并受到監督 .
現在我想在"api"應用程序中測試我的控制器 . 這是我遇到ecto問題的地方 . 當我測試控制器操作時,此操作將調用"auth"或"core"中的函數,該函數從"db"調用 Repo 的函數(例如 Repo.insert/2 ) . 這導致 OwnershipError :
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.458.0>.
When using ownership, you must manage connections in one
of the three ways:
* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.
The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.
If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.
See Ecto.Adapters.SQL.Sandbox docs for more information.
我現在的問題是我不知道如何使用“api”測試中建議的解決方案來修復此錯誤,因為“api”應用程序不知道“db”應用程序,因此無法進行連接檢查 . 當我在直接依賴于“db”項目的應用程序上遇到此錯誤時,我能夠應用“共享模式”解決方案 .
我的問題是如何用“api”集成測試解決所有權問題 .
總結
以上是生活随笔為你收集整理的java代码输出伞_在伞中集成测试Web应用程序的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java swing http请求_Ja
- 下一篇: java复制类mytool_MyTool