Tests: unit_stop() removed where possible.
Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log.
This commit is contained in:
@@ -2,7 +2,6 @@ import time
|
||||
|
||||
import pytest
|
||||
|
||||
from conftest import unit_stop
|
||||
from unit.applications.lang.python import TestApplicationPython
|
||||
from unit.option import option
|
||||
|
||||
@@ -50,8 +49,6 @@ class TestAccessLog(TestApplicationPython):
|
||||
body='0123456789',
|
||||
)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"POST / HTTP/1.1" 200 10') is not None
|
||||
), 'keepalive 2'
|
||||
@@ -78,8 +75,6 @@ Connection: close
|
||||
raw=True,
|
||||
)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "Referer-1" "-"')
|
||||
is not None
|
||||
@@ -100,8 +95,6 @@ Connection: close
|
||||
|
||||
self.get(sock_type='ipv6')
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(
|
||||
r'::1 - - \[.+\] "GET / HTTP/1.1" 200 0 "-" "-"'
|
||||
@@ -120,8 +113,6 @@ Connection: close
|
||||
|
||||
self.get(sock_type='unix', addr=addr)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(
|
||||
r'unix: - - \[.+\] "GET / HTTP/1.1" 200 0 "-" "-"'
|
||||
@@ -140,8 +131,6 @@ Connection: close
|
||||
}
|
||||
)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "referer-value" "-"')
|
||||
is not None
|
||||
@@ -158,8 +147,6 @@ Connection: close
|
||||
}
|
||||
)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(
|
||||
r'"GET / HTTP/1.1" 200 0 "-" "user-agent-value"'
|
||||
@@ -172,8 +159,6 @@ Connection: close
|
||||
|
||||
self.get(http_10=True)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.0" 200 0 "-" "-"') is not None
|
||||
), 'http 1.0'
|
||||
@@ -187,8 +172,6 @@ Connection: close
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GE" 400 0 "-" "-"') is not None
|
||||
), 'partial'
|
||||
@@ -200,8 +183,6 @@ Connection: close
|
||||
|
||||
self.http(b"""GET /\n""", raw=True)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET /" 400 \d+ "-" "-"') is not None
|
||||
), 'partial 2'
|
||||
@@ -215,8 +196,6 @@ Connection: close
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET /" 400 0 "-" "-"') is not None
|
||||
), 'partial 3'
|
||||
@@ -230,8 +209,6 @@ Connection: close
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.1" 400 0 "-" "-"') is not None
|
||||
), 'partial 4'
|
||||
@@ -244,8 +221,6 @@ Connection: close
|
||||
|
||||
self.get(headers={'Connection': 'close'})
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.1" 400 \d+ "-" "-"')
|
||||
is not None
|
||||
@@ -256,8 +231,6 @@ Connection: close
|
||||
|
||||
self.get(url='/?blah&var=val')
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(
|
||||
r'"GET /\?blah&var=val HTTP/1.1" 200 0 "-" "-"'
|
||||
@@ -272,8 +245,6 @@ Connection: close
|
||||
|
||||
self.get(url='/delete')
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert self.search_in_log(r'/delete', 'access.log') is None, 'delete'
|
||||
|
||||
def test_access_log_change(self, temp_dir):
|
||||
@@ -285,8 +256,6 @@ Connection: close
|
||||
|
||||
self.get()
|
||||
|
||||
unit_stop()
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "-" "-"', 'new.log')
|
||||
is not None
|
||||
|
||||
Reference in New Issue
Block a user