File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 138138}
139139"""
140140
141+ TESTBLOCK_CASE_7 = """
142+ upstream xx.com_backend {
143+ server 10.193.2.2:9061 weight=1 max_fails=2 fail_timeout=30s;
144+ server 10.193.2.1:9061 weight=1 max_fails=2 fail_timeout=30s;
145+ session_sticky;
146+ }
147+
148+ server {
149+ listen 80;
150+
151+ location / {
152+ set $xlocation 'test';
153+ proxy_pass http://xx.com_backend;
154+ }
155+ }
156+ """
157+
158+
141159
142160class TestPythonNginx (unittest .TestCase ):
143161 def test_basic_load (self ):
@@ -213,6 +231,11 @@ def test_complex_upstream(self):
213231 out_data = '\n ' + nginx .dumps (inp_data )
214232 self .assertEqual (TESTBLOCK_CASE_6 , out_data )
215233
234+ def test_session_sticky (self ):
235+ inp_data = nginx .loads (TESTBLOCK_CASE_7 )
236+ out_data = '\n ' + nginx .dumps (inp_data )
237+ self .assertEqual (TESTBLOCK_CASE_7 , out_data )
238+
216239 def test_filtering (self ):
217240 data = nginx .loads (TESTBLOCK_CASE_1 )
218241 self .assertEqual (len (data .server .filter ('Key' , 'mykey' )), 1 )
You can’t perform that action at this time.
0 commit comments