未验证 提交 7769797d 编写于 作者: Y Yang Zhao 提交者: GitHub

fix: fixed connection error if -h was used (#13926) (#13937)

* test: add test case for TS-1613

* fix: fixed connection error if -h was used

* fix: assign port if -P is specified

* fix: windows read env
Co-authored-by: NPing Xiao <pxiao@taosdata.com>
Co-authored-by: Nxywang <xywang@taosdata.com>
Co-authored-by: NYang Zhao <yzhao@taosdata.com>
Co-authored-by: NXingY Wang <winshining@163.com>
Co-authored-by: NPing Xiao <pxiao@taosdata.com>
Co-authored-by: Nxywang <xywang@taosdata.com>
上级 5970117a
......@@ -24,7 +24,6 @@
#define OPT_ABORT 1 /* �Cabort */
int indicator = 1;
int p_port = 6041;
struct termios oldtio;
extern int wcwidth(wchar_t c);
......@@ -79,7 +78,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
if (arg) {
args.cloud = false;
tsDnodeShellPort = atoi(arg);
p_port = atoi(arg);
args.port = atoi(arg);
} else {
fprintf(stderr, "Invalid port\n");
return -1;
......
......@@ -250,6 +250,12 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
if (args.cloudDsn == NULL) {
if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn[strlen(args.cloudDsn) - 1] == '\"') {
args.cloudDsn[strlen(args.cloudDsn) - 1] = '\0';
}
if (args.cloudDsn[0] == '\"') {
args.cloudDsn += 1;
}
if (args.cloudDsn == NULL) {
args.cloud = false;
}
......
......@@ -15,6 +15,7 @@ import sys
from util.log import *
from util.cases import *
from util.sql import *
import os
from datetime import timedelta
......@@ -74,6 +75,14 @@ class TDTestCase:
tdSql.checkData(0, 0, 2)
tdSql.checkData(0, 1, "master")
cmd = "taos -h 127.0.0.1 -s 'show databases'"
r = os.popen(cmd)
text = r.read()
r.close
if 'Unable to establish connection' in text:
tdLog.exit("%s failed: command 'taos -h 127.0.0.1' Unable to establish connection" % __file__)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册