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
4be100e0
Commit
4be100e0
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Added /streaming/ test in Nginx test (refs
#20017
).
parent
a86191e8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/test_apt.sh
+2
-3
2 additions, 3 deletions
tests/test_apt.sh
tests/test_nginx_vhosts.py
+67
-38
67 additions, 38 deletions
tests/test_nginx_vhosts.py
tests/test_ntp.sh
+2
-2
2 additions, 2 deletions
tests/test_ntp.sh
with
71 additions
and
43 deletions
tests/test_apt.sh
+
2
−
3
View file @
4be100e0
#!/bin/bash
s
ource
/root/envsetup/conf.sh
s
et
-e
echo
"Testing apt-get upgrade"
...
...
@@ -7,9 +7,8 @@ echo "Clean repository"
apt-get clean
#Testing if sl package exists and remove it
dpkg
-l
|
awk
'{print $2}'
|
grep
'^sl$'
if
[
"
$?
"
-eq
"0"
]
;
then
if
(
dpkg
-s
sl
>
/dev/null 2>&1
)
;
then
echo
"Removing already installed testing package"
apt-get
-y
remove sl
fi
...
...
This diff is collapsed.
Click to expand it.
tests/test_nginx_vhosts.py
+
67
−
38
View file @
4be100e0
...
...
@@ -3,6 +3,7 @@
'''
Check the response status code of all enabled vhosts.
Allowed status code are: 403 and 200.
Also check Wowza response for all mediaserver vhosts.
'''
import
os
import
re
...
...
@@ -10,47 +11,75 @@ import requests
import
sys
# check that Nginx dir exists
nginx_dir
=
'
/etc/nginx/sites-enabled
'
if
not
os
.
path
.
exists
(
nginx_dir
):
print
(
'
Nginx dir does not exists (
"
%s
"
).
'
%
nginx_dir
)
# check that Wowza is installed
wowza_dir
=
'
/usr/local/WowzaStreamingEngine
'
if
not
os
.
path
.
exists
(
wowza_dir
):
print
(
'
Info: Wowza is not installed (
"
%s
"
does not exist).
'
%
wowza_dir
)
wowza_dir
=
None
else
:
requests
.
packages
.
urllib3
.
disable_warnings
()
found
=
False
errors
=
0
for
name
in
os
.
listdir
(
nginx_dir
):
path
=
os
.
path
.
join
(
nginx_dir
,
name
)
with
open
(
path
,
'
r
'
)
as
fo
:
conf
=
fo
.
read
()
conf
=
conf
.
replace
(
'
\t
'
,
'
'
)
matching
=
re
.
search
(
r
'
.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*
'
,
conf
)
if
not
matching
:
print
(
'
The server_name was not found in:
"
%s
"
.
'
%
path
)
print
(
'
Info: Wowza is installed, /streaming/ will be tested on mediaserver vhosts.
'
%
wowza_dir
)
# get enabled vhosts
requests
.
packages
.
urllib3
.
disable_warnings
()
found
=
False
errors
=
0
for
name
in
os
.
listdir
(
nginx_dir
):
path
=
os
.
path
.
join
(
nginx_dir
,
name
)
with
open
(
path
,
'
r
'
)
as
fo
:
conf
=
fo
.
read
()
conf
=
conf
.
replace
(
'
\t
'
,
'
'
)
matching
=
re
.
search
(
r
'
.*server_name\ +([0-9a-zA-Z\.\-\_\ ]+);.*
'
,
conf
)
if
not
matching
:
print
(
'
The server_name was not found in:
"
%s
"
.
'
%
path
)
errors
+=
1
continue
domains
=
matching
.
groups
()[
0
].
strip
().
split
(
'
'
)
https
=
re
.
search
(
r
'
listen +\w* +ssl;
'
,
conf
)
is
not
None
\
or
re
.
search
(
r
'
ssl +on;
'
,
conf
)
is
not
None
for
domain
in
domains
:
if
domain
==
'
localhost
'
:
continue
# status vhost
found
=
True
url
=
'
%s://%s
'
%
(
'
https
'
if
https
else
'
http
'
,
domain
)
sys
.
stdout
.
write
(
'
Testing url
"
%s
"
:
'
%
url
)
try
:
req
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
10
)
except
Exception
as
e
:
code
=
str
(
e
)
else
:
code
=
req
.
status_code
if
code
not
in
(
200
,
403
):
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
code
)
errors
+=
1
continue
domains
=
matching
.
groups
()[
0
].
strip
().
split
(
'
'
)
https
=
re
.
search
(
r
'
listen +\w* +ssl;
'
,
conf
)
is
not
None
\
or
re
.
search
(
r
'
ssl +on;
'
,
conf
)
is
not
None
for
domain
in
domains
:
if
domain
==
'
localhost
'
:
continue
# status vhost
found
=
True
url
=
'
%s://%s
'
%
(
'
https
'
if
https
else
'
http
'
,
domain
)
sys
.
stdout
.
write
(
'
Testing url
"
%s
"
:
'
%
url
)
try
:
req
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
10
)
except
Exception
as
e
:
code
=
str
(
e
)
else
:
code
=
req
.
status_code
if
code
==
200
or
code
==
403
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s).
\033
[0m
\n
'
%
code
)
else
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s).
\033
[0m
\n
'
%
code
)
errors
+=
1
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s)
\033
[0m
'
%
code
)
if
'
mediaserver
'
in
name
and
wowza_dir
:
# test /streaming url
sys
.
stdout
.
write
(
'
, streaming:
'
)
try
:
req
=
requests
.
get
(
url
+
'
/streaming/
'
,
verify
=
False
,
proxies
=
{
'
http
'
:
''
,
'
https
'
:
''
},
timeout
=
10
)
except
Exception
as
e
:
code
=
str
(
e
)
else
:
code
=
req
.
status_code
if
code
!=
200
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s)
\033
[0m
'
%
code
)
errors
+=
1
elif
'
Wowza Streaming Engine
'
not
in
req
.
text
:
sys
.
stdout
.
write
(
'
\033
[91mKO (%s, %s)
\033
[0m
'
%
(
code
,
req
.
text
.
replace
(
'
\n
'
,
'
'
)[:
200
]))
errors
+=
1
else
:
sys
.
stdout
.
write
(
'
\033
[92mOK (%s)
\033
[0m
'
%
code
)
sys
.
stdout
.
write
(
'
.
\n
'
)
if
errors
:
print
(
'
%s vhost(s) did not correctly responded.
'
%
errors
)
sys
.
exit
(
1
)
if
not
found
:
print
(
'
No vhost found in Nginx sites-enabled dir.
'
)
sys
.
exit
(
1
)
if
errors
:
print
(
'
%s vhost(s) did not correctly responded.
'
%
errors
)
sys
.
exit
(
1
)
if
not
found
:
print
(
'
No vhost found in Nginx sites-enabled dir.
'
)
sys
.
exit
(
1
)
This diff is collapsed.
Click to expand it.
tests/test_ntp.sh
+
2
−
2
View file @
4be100e0
#!/bin/bash
source
/root/envsetup/conf.sh
set
-e
source
/root/envsetup/conf.sh
NTP_SERVER
=
"
$NTP_SERVER1
"
if
[
"
${
NTP_SERVER
}
"
=
""
]
;
then
NTP_SERVER
=
"ntp.ubuntu.com"
...
...
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