Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nirina Malard
slapos
Commits
af9ab301
Commit
af9ab301
authored
Jun 01, 2021
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Provide assertLastLogLineRegexp method
parent
cf89ce81
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
31 deletions
+27
-31
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+27
-31
No files found.
software/caddy-frontend/test/test.py
View file @
af9ab301
...
...
@@ -1201,6 +1201,16 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
return
parameter_dict
def
assertLastLogLineRegexp
(
self
,
log_name
,
log_regexp
):
log_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
instance_path
,
'*'
,
'var'
,
'log'
,
'httpd'
,
log_name
))[
0
]
self
.
assertRegexpMatches
(
open
(
log_file
,
'r'
).
readlines
()[
-
1
],
log_regexp
)
class
TestMasterRequestDomain
(
HttpFrontendTestCase
,
TestDataMixin
):
@
classmethod
...
...
@@ -1891,38 +1901,24 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
result
.
headers
[
'Set-Cookie'
]
)
# check access log
log_file
=
glob
.
glob
(
os
.
path
.
join
(
self
.
instance_path
,
'*'
,
'var'
,
'log'
,
'httpd'
,
'_Url_access_log'
))[
0
]
log_regexp
=
r'^\
d{
1,3}\
.
\d{1,3}\
.
\d{1,3}\
.
\d{1,3} - - '
\
r'\
[
\d{2}\
/.{
3}\
/
\d{4}\
:
\d{2}\
:
\d{2}\
:
\d{2} \
+
\d{4}\
]
' \
r'"GET
\
/
t
est-path
\
/deep
\
/..
\
/.
\
/deeper HTTP
\
/
1
.1"
\
d
{
3
}
'
\
self
.
assertLastLogLineRegexp
(
'_Url_access_log'
,
r'^\
d{
1,3}\
.
\d{1,3}\
.
\d{1,3}\
.
\d{1,3} - - '
r'\
[
\d{2}\
/.{
3}\
/
\d{4}\
:
\d{2}\
:
\d{2}\
:
\d{2} \
+
\d{4}\
]
'
r'"GET
\
/
t
est-path
\
/deep
\
/..
\
/.
\
/deeper HTTP
\
/
1
.1"
\
d
{
3
}
'
r'
\
d
+
"-"
"TEST USER AGENT"
\
d
+
'
)
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
# check backend log
log_file = glob.glob(
os.path.join(
self.instance_path, '
*
', '
var
', '
log
', '
httpd
', '
_Url_backend_log
'
))[0]
log_regexp = r'
^
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}:
\
d
+
'
\
r'
\
[
\
d
{
2
}
\
/
.{
3
}
\
/
\
d
{
4
}
\
:
\
d
{
2
}
\
:
\
d
{
2
}
\
:
\
d
{
2
}.
\
d
{
3
}
\
]
'
\
r'
http
-
backend
_Url
-
http
\
/
_Url
-
backend
'
\
r'
\
d
+/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
'
\
r'
200
\
d
+
-
-
----
'
\
r'
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
d
+
\
/
\
d
+
'
\
self.assertLastLogLineRegexp(
'
_Url_backend_log
',
r'
^
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}
\
.
\
d
{
1
,
3
}:
\
d
+
'
r'
\
[
\
d
{
2
}
\
/
.{
3
}
\
/
\
d
{
4
}
\
:
\
d
{
2
}
\
:
\
d
{
2
}
\
:
\
d
{
2
}.
\
d
{
3
}
\
]
'
r'
http
-
backend
_Url
-
http
\
/
_Url
-
backend
'
r'
\
d
+/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
'
r'
200
\
d
+
-
-
----
'
r'
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
/
\
d
+
\
d
+
\
/
\
d
+
'
r'"GET /test-path/deeper HTTP/1.1"'
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
)
result_http = fakeHTTPResult(
parameter_dict['
domain
'],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment