Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
0d37f1f2
Commit
0d37f1f2
authored
7 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Changed timeout in nginx vhost test (refs
#22843
).
parent
e5883735
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_nginx_vhosts.py
+23
-8
23 additions, 8 deletions
tests/test_nginx_vhosts.py
with
23 additions
and
8 deletions
tests/test_nginx_vhosts.py
+
23
−
8
View file @
0d37f1f2
...
@@ -10,6 +10,11 @@ import re
...
@@ -10,6 +10,11 @@ import re
import
requests
import
requests
import
socket
import
socket
import
sys
import
sys
try
:
from
requests.packages.urllib3.exceptions
import
InsecureRequestWarning
requests
.
packages
.
urllib3
.
disable_warnings
(
InsecureRequestWarning
)
except
ImportError
:
requests
.
packages
.
urllib3
.
disable_warnings
()
'''
'''
This script checks for all enabled vhosts in Nginx conf that:
This script checks for all enabled vhosts in Nginx conf that:
...
@@ -70,7 +75,7 @@ for name in os.listdir(nginx_dir):
...
@@ -70,7 +75,7 @@ for name in os.listdir(nginx_dir):
url
=
'
%s://%s
'
%
(
'
https
'
if
https
else
'
http
'
,
domain
)
url
=
'
%s://%s
'
%
(
'
https
'
if
https
else
'
http
'
,
domain
)
sys
.
stdout
.
write
(
'
Testing url
"
%s
"
:
\n
'
%
url
)
sys
.
stdout
.
write
(
'
Testing url
"
%s
"
:
\n
'
%
url
)
if
name
.
startswith
(
'
mediaserver
'
)
and
url
not
in
celerity_conf
:
if
name
.
startswith
(
'
mediaserver
'
)
and
url
not
in
celerity_conf
:
sys
.
stdout
.
write
(
'
Url
"
%s
"
not found in celerity conf; it should also be set in the MediaWorker.
\n
'
%
url
)
sys
.
stdout
.
write
(
'
\033
[93mWarning:
\033
[0m
Url
"
%s
"
not found in celerity conf; it should also be set in the MediaWorker.
\n
'
%
url
)
warnings
+=
1
warnings
+=
1
# test domain IP
# test domain IP
ip_error
=
None
ip_error
=
None
...
@@ -94,37 +99,47 @@ for name in os.listdir(nginx_dir):
...
@@ -94,37 +99,47 @@ for name in os.listdir(nginx_dir):
sys
.
stdout
.
write
(
'
\033
[94mIgnored (%s)
\033
[0m
'
%
ip_warning
)
sys
.
stdout
.
write
(
'
\033
[94mIgnored (%s)
\033
[0m
'
%
ip_warning
)
ip_warning
=
None
ip_warning
=
None
else
:
else
:
sys
.
stdout
.
write
(
'
\033
[9
1
mWarning (%s)
\033
[0m
'
%
ip_warning
)
sys
.
stdout
.
write
(
'
\033
[9
3
mWarning (%s)
\033
[0m
'
%
ip_warning
)
else
:
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (127.0.0.1)
\033
[0m
'
)
sys
.
stdout
.
write
(
'
\033
[92mOK (127.0.0.1)
\033
[0m
'
)
# test url
# test url
sys
.
stdout
.
write
(
'
, status:
'
)
sys
.
stdout
.
write
(
'
, status:
'
)
req_error
=
False
req_error
=
False
try
:
try
:
req
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
10
)
req
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
30
)
req_time
=
int
(
1000
*
req
.
elapsed
.
total_seconds
())
except
Exception
as
e
:
except
Exception
as
e
:
code
=
str
(
e
)
code
=
str
(
e
)
req_time
=
0
else
:
else
:
code
=
req
.
status_code
code
=
req
.
status_code
if
code
not
in
(
200
,
403
):
if
code
not
in
(
200
,
403
):
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
code
)
sys
.
stdout
.
write
(
'
\033
[91mKO (%s
, %sms
)
\033
[0m
'
%
(
code
,
req_time
)
)
req_error
=
True
req_error
=
True
else
:
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s)
\033
[0m
'
%
code
)
if
req_time
>
10000
:
sys
.
stdout
.
write
(
'
\033
[93mOK (%s, %sms)
\033
[0m
'
%
(
code
,
req_time
))
warnings
+=
1
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s, %sms)
\033
[0m
'
%
(
code
,
req_time
))
if
'
mediaserver
'
in
name
and
wowza_dir
:
if
'
mediaserver
'
in
name
and
wowza_dir
:
# test /streaming url
# test /streaming url
sys
.
stdout
.
write
(
'
, streaming:
'
)
sys
.
stdout
.
write
(
'
, streaming:
'
)
try
:
try
:
req
=
requests
.
get
(
url
+
'
/streaming/
'
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
10
)
req
=
requests
.
get
(
url
+
'
/streaming/
'
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
30
)
req_time
=
int
(
1000
*
req
.
elapsed
.
total_seconds
())
except
Exception
as
e
:
except
Exception
as
e
:
code
=
str
(
e
)
code
=
str
(
e
)
req_time
=
0
else
:
else
:
code
=
req
.
status_code
code
=
req
.
status_code
if
code
!=
200
:
if
code
!=
200
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
code
)
sys
.
stdout
.
write
(
'
\033
[91mKO (%s
, %sms
)
\033
[0m
'
%
(
code
,
req_time
)
)
req_error
=
True
req_error
=
True
elif
req_time
>
10000
:
sys
.
stdout
.
write
(
'
\033
[93mOK (%s, %sms)
\033
[0m
'
%
(
code
,
req_time
))
else
:
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s)
\033
[0m
'
%
code
)
sys
.
stdout
.
write
(
'
\033
[92mOK (%s
, %sms
)
\033
[0m
'
%
(
code
,
req_time
)
)
sys
.
stdout
.
write
(
'
.
\n
'
)
sys
.
stdout
.
write
(
'
.
\n
'
)
if
ip_warning
:
if
ip_warning
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment