为什么Capistrano突然在部署期间无法从我的Bitbucket Git存储库中读取?(Why suddenly is Capistrano unable to read from my Bitbucket Git repository during deploy?)
我使用Capistrano(v3.5.0)使用在Bitbucket上设置的部署密钥,将本地开发机器上的小型Rails应用程序部署到Linode上托管的VPS。 就在上周,它的工作就像一个魅力。
然而,今天,当我运行通常的
cap deploy
命令时,它尝试从我的Bitbucket Git存储库读取时,在第三步失败:DEBUG [6906a62c] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.1" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/app/git-ssh.sh" ; /usr/bin/env git ls-remote --heads git@bitbucket.org:klenwell/app.git )
这是错误:
DEBUG [6906a62c] conq: repository access denied. DEBUG [6906a62c] fatal: The remote end hung up unexpectedly
我已经完成了明显的故障排除:谷歌搜索错误消息,确认VPS正常运行,验证存储库是否可访问,双重检查SSH密钥,确认SSH代理正在运行。 如果所有其他方法都失败了,我会尝试在我的VPS主机上生成一个新密钥。
这些要点尤其令我感到困惑:
- (据我所知)自上次成功运行以来,没有对Capistrano或VPS配置进行任何更改。 上周我看到同样的命令在我的Capistrano日志中成功运行。
- 当我作为部署用户ssh进入我的VPS服务器时,我可以手动运行
ssh -T git@bitbucket.org
和相同的git命令而不会出现问题。- 我本地计算机上的Jenkins服务器可以使用其部署密钥从同一个Bitbucket存储库成功读取。
我错过了什么?
I use Capistrano (v3.5.0) to deploy a small Rails application from my local development machine to a VPS hosted on Linode using a deployment key set up on Bitbucket. As late as last week, it was working like a charm.
Today, however, when I run the usual
cap deploy
command, it fails at the third step when it tried to read from my Bitbucket Git repository:DEBUG [6906a62c] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.1" GIT_ASKPASS="/bin/echo" GIT_SSH="/tmp/app/git-ssh.sh" ; /usr/bin/env git ls-remote --heads git@bitbucket.org:klenwell/app.git )
This is the error:
DEBUG [6906a62c] conq: repository access denied. DEBUG [6906a62c] fatal: The remote end hung up unexpectedly
I've done the obvious troubleshooting: googled the errors messages, confirmed the VPS is operational, verified the repository is accessible, double-checked the SSH keys, confirmed the SSH agent is running. If all else fails, I will try generating a new key on my VPS host.
These points in particular have me flummoxed:
- There have been (as far as I can tell) no changes to the Capistrano or VPS configuration since it last ran successfully. I see the same command running successfully in my Capistrano logs last week.
- When I ssh into my VPS server as the deploy user, I can run
ssh -T git@bitbucket.org
and the same exact git command manually without issue.- The Jenkins server on my local machine can successfully read from the same Bitbucket repository using its deployment key.
What am I missing?
原文:https://stackoverflow.com/questions/38186432
最满意答案
您可以使用JUnit的
InOrder
。DbCall dbCall = mock(DbCall.class); List<Element> list = Arrays.asList(newElement(1), newElement(2), newElement(3)); runDeleteMethod(list); InOrder inorder = inOrder(dbCall); inorder.verify(dbCall).delete(1); inorder.verify(dbCall).delete(2); inorder.verify(dbCall).delete(3);
You can use JUnit's
InOrder
.DbCall dbCall = mock(DbCall.class); List<Element> list = Arrays.asList(newElement(1), newElement(2), newElement(3)); runDeleteMethod(list); InOrder inorder = inOrder(dbCall); inorder.verify(dbCall).delete(1); inorder.verify(dbCall).delete(2); inorder.verify(dbCall).delete(3);
相关问答
更多-
我发现的唯一解决方案就是通过工具测试(androidTest目录)使用JUnit。 我的类现在可以很好地测试,但在Android设备或模拟器的帮助下。 The only solution I found that works without hacks is to use JUnit through instrumentation testing (androidTest directory). My class can now be tested fine but with help of the and ...
-
您可以创建一个TestSuite并在其中运行所有测试, if __name__ == '__main__'块: import unittest def create_suite(): test_suite = unittest.TestSuite() test_suite.addTest(fooTest()) test_suite.addTest(barTest()) return test_suite if __name__ == '__main__': s ...
-
首先,通过大多数定义,“单元”测试不依赖于像数据库这样的外部系统。 你想创建所谓的“功能”或“集成”测试。 在实践中,这些类型的测试将像单元测试一样使用类似Junit的方式来实现,但是您应该将它们与单元测试分开,单元测试应该运行得非常快并且在数据库关闭或数据发生更改时不会中断。 其次,尽量将大部分业务逻辑保留在DAO之外,并将其放入服务POJO层,以便测试业务逻辑而不涉及数据库。 接下来,设置DAO测试的理想方法是从一个空数据库开始,并使用测试数据(通常使用DAO本身)加载测试数据,然后针对已知和可写的测试 ...
-
Java单元测试帮助循环(Java Unit Testing Help for loop)[2019-12-08]
您的代码很难阅读。 学习Java编码标准 。 你的方法不应该打印任何东西。 确定用户是否有效。 在别处打印消息。 我假设你有一个封装凭证的类用户: package misc.user; import org.apache.commons.lang3.StringUtils; /** * Created by Michael * Creation date 8/5/2017. * @link https://stackoverflow.com/questions/45524768/java-unit ... -
您可以使用JUnit的InOrder 。 DbCall dbCall = mock(DbCall.class); List
list = Arrays.asList(newElement(1), newElement(2), newElement(3)); runDeleteMethod(list); InOrder inorder = inOrder(dbCall); inorder.verify(dbCall).delete(1); inorder.verify(dbCall).d ... -
关于单元测试的建议,要测试的类依赖于Java串口(Advice on unit testing, class to test has dependency on Java serial port)[2021-10-02]
从外观javax.comm , javax.comm API并不能让单元测试变得简单 - 它在类上很重要,而且在接口上很轻松。 我的建议是为你需要在驱动程序中使用的每个javax.comm类创建接口和适配器类。 然后,您的驱动程序代码将与这些接口进行通信,而不是直接与javax.comm进行javax.comm 。 您可能只需要API的一个子集,定义这些接口应该可以帮助您阐明您的设计。 这将允许您在单元测试中使用这些接口的模拟实现(例如JMock,Mockito等)。 您的单元测试可以将这些模拟注入到驱动程 ... -
EclEmma是一个Eclipse插件,可以做到这一点。 EclEmma is an Eclipse plugin that does just that.
-
我如何在node.js中对文件流进行单元测试呢?(How would I go about unit testing something with file streams in node.js?)[2023-09-18]
将我的评论作为扩展答案发布。 首先,您需要将数据句柄函数提取到另一个模块中,例如data-handler.js (这是您的代码的一个示例,它可能会被增强以使其看起来更好,但它只是提供了一个想法) module.exports = { handler: (rowData, topCsvStream, otherCsvStream) => { if(headerRow.length === 0) { // Save header row in CSV's h ... -
这是Java依赖关系如何工作的结果。 运行JUnit测试时,src / test / java目录用作要运行的项目,src / main / java被视为依赖项。 当java尝试解析导入路径时,它不知道该路径是来自内部文件还是依赖项。 因此,它将首先尝试在项目中解决它,然后查看依赖项。 如果它在项目中找到匹配项,它将不会再看了。 同样,当运行'生产'代码时,src / main / java被用作主项目而不依赖于src / test / java,因此它将始终获得MyObject的原始实现。 以这种方式覆 ...
-
你必须在这里明确责任。 一部分是实际的“服务”,它必须与该数据库通信,并且您希望通过SwingWorker运行。 我会完全独立于线程上下文来实现DBService 。 而且DBService类与SwingWorker 没有任何关系。 它是一个“独立”类,提供特定服务,可以完全单元测试,无需担心SwingWorker或线程。 然后你创建自己的小SwingWorker,它接受该DBService的一个实例并使用该对象来完成它的工作。 现在,您可以将一个模拟的DBService实例提供给您的SwingWorker ...