nginxinc / crossplane

Quick and reliable way to convert NGINX configurations into JSON and back.
Apache License 2.0
717 stars 86 forks source link

Modifies inplace correct for 3.5,3.6,3.7,3.8 but not 2.7 #80

Closed SamuelMarks closed 4 years ago

SamuelMarks commented 4 years ago

Describe the bug

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/2.7.17/x64/lib/python2.7/site-packages/nginxctl/tests/test_parser.py", line 66, in test_filter_map_block
    {u'directive': u'server_name', u'args': [u'example.com']})
AssertionError: {'args': [u'localhost'], 'directive': u'server_name'} != {u'args': [u'example.com'], u'directive': u'server_name'}
- {'args': [u'localhost'], 'directive': u'server_name'}
?               ^^^^^^^

+ {u'args': [u'example.com'], u'directive': u'server_name'}
?  +           +++++ +++ ^    +

https://github.com/offscale/nginxctl/runs/551701801 as you can see I was playing around with different commits to try and solve the unicode inconsistencies, but on second glance there is an actual problem here with localhost not being replaced with example.com :\

framer777 commented 4 years ago

Looks like the problem is here: https://github.com/offscale/nginxctl/blob/master/nginxctl/tests/test_parser.py#L55-L58 the argument is not updated in Py 2.7.

The assertion above is always passing: https://github.com/offscale/nginxctl/blob/master/nginxctl/tests/test_parser.py#L49-L51 so crossplane parsing was correct in all Python versions.

Also, Python 2.7 reached its EOL on January 1st, 2020.