Skip to content

Commit 337bbed

Browse files
authored
Merge pull request #153 from scality/bugfix/PTFE-1834-check-active-connection-prestop
PTFE-1834 check for active connections on prestop
2 parents d10aa51 + 8e57e48 commit 337bbed

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

charts/artifacts/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,4 @@ deployment:
186186
## Affinity for pod assignment
187187
##
188188
affinity: {}
189-
terminationGracePeriodSeconds: 300
189+
terminationGracePeriodSeconds: 600

stop.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
55
echo "Stopping nginx..."
66
# Wait a bit before signaling the process to stop
77
sleep 5
8+
9+
# retrieve nginx status and check if there's any active connection
10+
ACTIVE_CONNECTION=""
11+
12+
while [ ${ACTIVE_CONNECTION} != "1" ]; do
13+
ACTIVE_CONNECTION=$(curl -s http://localhost/nginx_status | grep 'Active connections' | awk '{print $3}')
14+
echo "Active connections: ${ACTIVE_CONNECTION}"
15+
sleep 1
16+
done
17+
818
PID=$(cat /run/nginx.pid)
919
nginx -s quit
1020

tests/end2end/test_simple.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,19 @@ def test_simple_redirections(self):
638638
), headers={'Script-Name': '/foo'})
639639
assert 'Location' not in req.headers
640640

641+
def test_nginx_status(self):
642+
# assert "Active connections: 1" in req.text
643+
# retry as much as needed in case there is more active connections from other
644+
# tests running
645+
for _ in range(10):
646+
req = self.session.get(f"{self.artifacts_url}/nginx_status")
647+
if "Active connections: 1 \n" in req.text:
648+
break
649+
if _ == 9:
650+
assert False, "Active connections: 1 not found in nginx_status"
651+
time.sleep(1)
652+
653+
641654

642655
@pytest.mark.usefixtures("s3_client", "container", "artifacts_url", "buckets")
643656
class TestExternalBasicAuthentication(unittest.TestCase):

0 commit comments

Comments
 (0)