简体   繁体   English

测试失败由gitlab-ci运行,但未在bash中运行

[英]Tests fail ran by gitlab-ci, but not ran in bash

I'm using gitlab-ci to automatically build a C++ project and run unit-tests written in python (it runs the daemon, and then communicates via the network/socket based interface). 我正在使用gitlab-ci自动构建C ++项目并运行以python编写的单元测试(它运行守护程序,然后通过基于网络/套接字的接口进行通信)。

The problem I'm finding is that when the tests are run by the GitLab-CI runner, they fail for various reasons (with one test, it stalls indefinitely on a particular network operation, on the other it doesn't receive a packet that should have been sent). 我发现的问题是,当测试由GitLab-CI运行程序运行时,它们由于各种原因而失败(对于一个测试,它会在特定的网络操作上无限期地停止,而在另一个测试中,它不会接收到一个应该已经发送)。

BUT: When I open up SSH and run the tests manually, they all work successfully (the tests also succeed on all of our developers' machines [linux/windows/OSX]). 但是:当我打开SSH并手动运行测试时,它们都可以成功运行(这些测试在我们所有开发人员的计算机[linux / windows / OSX]上也都可以成功)。

At this point I've been trying to replicate enough of the build/test conditions that gitlab-ci is using but I don't really know any exact details, and none of my experiments have reproduced the problem. 在这一点上,我一直在尝试复制gitlab-ci正在使用的足够的构建/测试条件,但是我真的不知道任何确切的细节,而且我的实验都没有重现该问题。

I'd really appreciate help with either of the following: 我非常感谢以下任何一项的帮助:

  • Guidance on running the tests manually outside of gitlab-ci, but replicating its environment so I can get the same errors/failures and debug the daemon and/or tests, OR 关于在gitlab-ci之外手动运行测试的指南,但是复制了它的环境,这样我就可以得到相同的错误/失败并调试守护程序和/或测试,或者
  • Insight into why the test would fail when ran by GitLab-CI-Runner 了解为什么GitLab-CI-Runner运行测试失败

Sidetrack 1: For some reason, not all the (mostly debugging) output that would normally be sent to the shell shows up in the gitlab-ci output. 旁白1:由于某种原因,通常会发送到shell的所有(大部分是调试的)输出并未显示在gitlab-ci输出中。

Sidetrack 2: I also played around setting it up with jenkins, but one of the tests fails to even connect to the daemon, while the rest do it fine. 旁白2:我也尝试过使用jenkins进行设置,但是其中一项测试甚至无法连接到守护程序,而其余测试则可以正常进行。

-i usually replicate the problem by using a docker container only for the runner and running the tests inside it, dont know if you have it setup like this =(. -Normally the test doesnt actually fail if you log in the container you will see he actually does everything but doesnt report back to the Gilab CI, dont freak out it does it job it simply does not say it. -i通常通过仅对跑步者使用docker容器并在其中运行测试来复制问题,不知道您是否具有这样的设置=(。-通常,如果您登录该容器,则测试实际上不会失败他实际上做了所有事情,但是不向Gilab CI报告,不要惊慌,它只是在说它而已。

PS: you can see if its actually running by checking the processes on the machine. PS:您可以通过检查计算机上的进程来查看其是否真正运行。

example: im running a gitlab ci with java and docker: 示例:我使用Java和docker运行gitlab ci:

gitlab ci starts doing its thing then hangs at a download,meanwhile i log in the container and check that he is actually working and manages to upload my compiled docker image. gitlab ci开始执行其操作,然后挂起下载,同时我登录容器,并检查他是否确实在工作,并设法上传了我编译的docker映像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM