diff --git a/.travis/apisix_cli_test.sh b/.travis/apisix_cli_test.sh index d5898e796cb6..88e2ea885a75 100755 --- a/.travis/apisix_cli_test.sh +++ b/.travis/apisix_cli_test.sh @@ -73,6 +73,18 @@ done sed -i '/dns_resolver:/,+4s/^#//' conf/config.yaml echo "passed: system nameserver imported" +# check whether the 'worker_cpu_affinity' is in nginx.conf . + +make init + +grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null +if [ ! $? -eq 0 ]; then + echo "failed: nginx.conf file is missing worker_cpu_affinity configuration" + exit 1 +fi + +echo "passed: nginx.conf file contains worker_cpu_affinity configuration" + # check admin https enabled sed -i 's/\# port_admin: 9180/port_admin: 9180/' conf/config.yaml diff --git a/bin/apisix b/bin/apisix index 94848d608421..4c7ce34479f2 100755 --- a/bin/apisix +++ b/bin/apisix @@ -21,6 +21,8 @@ local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end +-- Note: The `excute_cmd` return value will have a line break at the end, +-- it is recommended to use the `trim` function to handle the return value. local function excute_cmd(cmd) local t, err = io.popen(cmd) if not t then @@ -676,7 +678,7 @@ local function init() local sys_conf = { lua_path = pkg_path_org, lua_cpath = pkg_cpath_org, - os_name = excute_cmd("uname"), + os_name = trim(excute_cmd("uname")), apisix_lua_home = apisix_home, with_module_status = with_module_status, error_log = {level = "warn"},