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

Update tests to check for hostname instead of fqdn #3027

Merged
merged 1 commit into from
Jan 12, 2025

Conversation

ajt89
Copy link
Contributor

@ajt89 ajt89 commented Jan 12, 2025

locust.test.test_log was broken locally for me as test_log was looking at the fqdn instead of hostname. To match this change: #2705

test_logs: commands[0]> python -m unittest -f locust.test.test_log
.F
======================================================================
FAIL: test_log_to_file (locust.test.test_log.TestLoggingOptions.test_log_to_file)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ajtuquero/Code/locust/locust/test/test_log.py", line 191, in test_log_to_file
    self.assertIn(
    ~~~~~~~~~~~~~^
        f"{socket.gethostname()}/INFO/locust.main: Run time limit set to 1 seconds",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        log_content,
        ^^^^^^^^^^^^
    )
    ^
AssertionError: 'AJs-MacBook-Air.local/INFO/locust.main: Run time limit set to 1 seconds' not found in '[2025-01-12 08:38:42,235] AJs-MacBook-Air/INFO/locust.main: Starting Locust 0.10.1.dev4312\n[2025-01-12 08:38:42,236] AJs-MacBook-Air/INFO/locust.main: Run time limit set to 1 seconds\n[2025-01-12 08:38:42,236] AJs-MacBook-Air/INFO/locust.runners: Ramping to 1 users at a rate of 1.00 per second\n[2025-01-12 08:38:42,236] AJs-MacBook-Air/INFO/locust.runners: All users spawned: {"MyUser": 1} (1 total users)\n[2025-01-12 08:38:42,236] AJs-MacBook-Air/INFO/root: custom log message\n[2025-01-12 08:38:43,126] AJs-MacBook-Air/INFO/locust.main: --run-time limit reached, shutting down\n[2025-01-12 08:38:43,161] AJs-MacBook-Air/INFO/locust.main: Shutting down (exit code 0)\n'

----------------------------------------------------------------------
Ran 2 tests in 1.224s

FAILED (failures=1)
test_logs: exit 1 (1.50 seconds) /Users/ajtuquero/Code/locust> python -m unittest -f locust.test.test_log pid=19383
  test_logs: FAIL code 1 (1.98=setup[0.03]+cmd[0.45,1.50] seconds)
  evaluation failed :( (2.03 seconds)

@cyberw
Copy link
Collaborator

cyberw commented Jan 12, 2025

Hi! A bit more context would be nice :) I'm guessing the tests were failing locally for you for some reason?

@ajt89
Copy link
Contributor Author

ajt89 commented Jan 12, 2025

Updated with details above, but essentially locust.test.test_log on my local were failing due to this change: #2705

@cyberw cyberw merged commit 9daa40b into locustio:master Jan 12, 2025
17 checks passed
@cyberw
Copy link
Collaborator

cyberw commented Jan 12, 2025

Thx! Guess it was just lucky/unlucky that it worked on github!

@ajt89 ajt89 deleted the fix-log-tests branch January 12, 2025 19:23
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 this pull request may close these issues.

2 participants