Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql Nodejs摩卡测试失败Jenkins_Mysql_Node.js_Jenkins_Mocha.js - Fatal编程技术网

Mysql Nodejs摩卡测试失败Jenkins

Mysql Nodejs摩卡测试失败Jenkins,mysql,node.js,jenkins,mocha.js,Mysql,Node.js,Jenkins,Mocha.js,我正在使用nodejs的mocha模块测试我的db连接,测试在本地通过 describe('Access to DB', function(){ describe('#fail', function(){ it('should return -1 because wrong credentials', function(done){ var connection = mysql.createConnection({ h

我正在使用nodejs的mocha模块测试我的db连接,测试在本地通过

describe('Access to DB', function(){
   describe('#fail', function(){
        it('should return -1 because wrong credentials', function(done){
            var connection = mysql.createConnection({
                host: 'localhost',
                user: 'root',
                password: 'head',
                database: 'head'
            });
            connection.connect(done);
        });
    })
});
/node\u modules/.bin/mocha./test/test.js
运行此命令时测试通过

但当我用詹金斯管理我的工作时。测试失败,出现错误:

访问DB#失败应返回-1,因为错误的凭据:[0m[31m错误:connect-Econrefuse127.0.0.1:3306[0m[90m在TCPConnectWrap.afterConnect[as-oncomplete]


我的jenkins安装在不同的服务器和不同的节点应用程序中。我使用SHA密钥在它们之间通信。除此测试外,一切正常。jenkins服务器中未安装mysql。这可能是原因。

您正在尝试连接到本地计算机上的mysql实例。尝试用IP地址替换“localhost”/您的DB计算机的主机名。itI已尝试,但显示超时错误,我拥有所有授予权限,并且我的绑定地址也已注释