From 8abc5eaeeebc09dfd88ccd5e75df7997a63b400a Mon Sep 17 00:00:00 2001 From: Brent Yarger Date: Fri, 23 Aug 2024 10:35:06 -0700 Subject: [PATCH] shorten unix domain socket names --- kong/constants.lua | 14 +++++++------- spec/helpers.lua | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/kong/constants.lua b/kong/constants.lua index 1a51fb803482..6de799f980b7 100644 --- a/kong/constants.lua +++ b/kong/constants.lua @@ -283,13 +283,13 @@ local constants = { SOCKET_DIRECTORY = "sockets", SOCKETS = { - WORKER_EVENTS = "worker_events.sock", - STREAM_WORKER_EVENTS = "stream_worker_events.sock", - CLUSTER_PROXY_SSL_TERMINATOR = "cluster_proxy_ssl_terminator.sock", - STREAM_CONFIG = "stream_config.sock", - STREAM_TLS_TERMINATE = "stream_tls_terminate.sock", - STREAM_TLS_PASSTHROUGH = "stream_tls_passthrough.sock", - STREAM_RPC = "stream_rpc.sock", + WORKER_EVENTS = "we", + STREAM_WORKER_EVENTS = "sw", + CLUSTER_PROXY_SSL_TERMINATOR = "cp", + STREAM_CONFIG = "sc", + STREAM_TLS_TERMINATE = "st", + STREAM_TLS_PASSTHROUGH = "sp", + STREAM_RPC = "rp", }, } diff --git a/spec/helpers.lua b/spec/helpers.lua index 36042101a304..13fdcdc65e93 100644 --- a/spec/helpers.lua +++ b/spec/helpers.lua @@ -3831,9 +3831,8 @@ local function cleanup_kong(prefix, preserve_prefix, preserve_dc) prefix = prefix or conf.prefix local socket_path = pl_path.join(prefix, constants.SOCKET_DIRECTORY) for child in lfs.dir(socket_path) do - -- TODO: use alternative method to remove socket files; maybe loop through SOCKETS constant - if child:sub(-5) == ".sock" then - local path = pl_path.join(socket_path, child) + local path = pl_path.join(socket_path, child) + if lfs.attributes(path, "mode") == "socket" then os.remove(path) end end