Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test test_no_config fails with custom ES port #843

Closed
hydrapolic opened this issue Dec 18, 2016 · 5 comments · Fixed by #849
Closed

test test_no_config fails with custom ES port #843

hydrapolic opened this issue Dec 18, 2016 · 5 comments · Fixed by #849

Comments

@hydrapolic
Copy link
Contributor

On gentoo linux we run the curator tests with es on custom port. Test test_no_config fails because without config it tries to connect to port 9200.

How to reproduce:
start ES on port 15000

export TEST_ES_SERVER="localhost:15000"
python setup.py test
...
test_no_config (test.integration.test_cli.TestCLIMethods) ... FAIL
...
======================================================================
FAIL: test_no_config (test.integration.test_cli.TestCLIMethods)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/curator-user/curator-4.2.4/test/integration/test_cli.py", line 57, in test_no_config
    self.assertEqual(0, result.exit_code)
AssertionError: 0 != -1
-------------------- >> begin captured logging << --------------------
DEBUG curator.validators.SchemaCheck               __init__:26   Schema: <Schema({'client': {'port': Any([None, All(Coerce(int, msg=None), Range(min=1, max=65535, min_included=True, max_included=True, msg=None), msg=None)]), 'url_prefix': Any([None, <type 'str'>, <type 'unicode'>]), 'aws_key': Any([None, <type 'str'>, <type 'unicode'>]), 'client_cert': Any([None, <type 'str'>, <type 'unicode'>]), 'ssl_no_validate': <function Boolean at 0x7f6c66fa3410>, 'certificate': Any([None, <type 'str'>, <type 'unicode'>]), 'use_ssl': <function Boolean at 0x7f6c66f6b6e0>, 'hosts': Any([None, <type 'str'>, <type 'unicode'>, <type 'list'>]), 'http_auth': Any([None, <type 'str'>, <type 'unicode'>]), 'aws_region': Any([None, <type 'str'>, <type 'unicode'>]), 'client_key': Any([None, <type 'str'>, <type 'unicode'>]), 'aws_secret_key': Any([None, <type 'str'>, <type 'unicode'>]), 'master_only': <function Boolean at 0x7f6c66fa3668>, 'timeout': All(Coerce(int, msg=None), Range(min=1, max=86400, min_included=True, max_included=True, msg=None), msg=None)}, 'logging': {'blacklist': Any([None, <type 'list'>]), 'loglevel': Any([None, 'NOTSET', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', All(Coerce(int, msg=None), Any([0, 10, 20, 30, 40, 50]), msg=None)]), 'logfile': Any([None, <type 'str'>, <type 'unicode'>]), 'logformat': Any([None, All(Any([<type 'str'>, <type 'unicode'>]), Any(['default', 'json', 'logstash']), msg=None)])}}, extra=PREVENT_EXTRA, required=False) object at 0x7f6c66fa9e10>
DEBUG curator.validators.SchemaCheck               __init__:27   "Client Configuration" config: {'client': {}, 'logging': {}}
INFO            curator.cli                    cli:147  Action ID: 1: "close" not performed because "disable_action" is set to True
INFO            curator.cli                    cli:151  Preparing Action ID: 2, "delete_indices"
--------------------- >> end captured logging << ---------------------

Curator tries to connect to port 9200

# tcpdump -i lo -n -A -s 2000 'port 9200'
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 2000 bytes
07:20:52.528046 IP 127.0.0.1.45888 > 127.0.0.1.9200: Flags [S], seq 247319827, win 43690, options [mss 65495,sackOK,TS val 6145446 ecr 0,nop,wscale 7], length 0
E..<..@.@.4..........@#..............0.........
.]..........
07:20:52.528067 IP 127.0.0.1.9200 > 127.0.0.1.45888: Flags [R.], seq 0, ack 247319828, win 0, length 0
E..(..@.@.].........#..@........P.......
07:20:52.529800 IP 127.0.0.1.45890 > 127.0.0.1.9200: Flags [S], seq 779689414, win 43690, options [mss 65495,sackOK,TS val 6145448 ecr 0,nop,wscale 7], length 0
E..<.n@.@.dK.........B#..y...........0.........
.]..........
07:20:52.529815 IP 127.0.0.1.9200 > 127.0.0.1.45890: Flags [R.], seq 0, ack 779689415, win 0, length 0
E..(..@.@.].........#..B.....y..P....[..
07:20:52.531499 IP 127.0.0.1.45892 > 127.0.0.1.9200: Flags [S], seq 3606032370, win 43690, options [mss 65495,sackOK,TS val 6145450 ecr 0,nop,wscale 7], length 0
E..<jX@.@..a.........D#..............0.........
.]..........
07:20:52.531514 IP 127.0.0.1.9200 > 127.0.0.1.45892: Flags [R.], seq 0, ack 3606032371, win 0, length 0
E..(..@.@.].........#..D........P...S...
07:20:52.533164 IP 127.0.0.1.45894 > 127.0.0.1.9200: Flags [S], seq 1617695886, win 43690, options [mss 65495,sackOK,TS val 6145451 ecr 0,nop,wscale 7], length 0
E..<.%@.@.k..........F#.`l...........0.........
.]..........
07:20:52.533178 IP 127.0.0.1.9200 > 127.0.0.1.45894: Flags [R.], seq 0, ack 1617695887, win 0, length 0
E..(..@.@.].........#..F....`l..P...e...
@untergeek
Copy link
Member

Try using 127.0.0.1 instead of localhost

@untergeek
Copy link
Member

The code properly recognizes when a given host and port are used. The test is mostly to ensure that defaults are used when things are empty. If I read in the passed host and port, then those defaults would be just as wrong. I'm not sure I can do what you're asking. I will see if I can change the test to behave more like a unit test, even though it's an integration test.

In the meanwhile, you can safely ignore this error as it's a false positive. It is doing what it's supposed to do: use localhost and 9200 as the connection criteria if none are provided.

@untergeek
Copy link
Member

I'll use an if statement. If TEST_ES_SERVER is set to something other than localhost:9200, expect a fail value, otherwise expect success.

@hydrapolic
Copy link
Contributor Author

Right now,I've just commented out the test.

The condition to run the test based on the host:port seems like the best solution for this case.

Another approach would be to skip the test with something like:
python setup.py test --skip-tests=test_no_config

@hydrapolic
Copy link
Contributor Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants