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
Levin Zimmermann
slapos
Commits
e5b4b198
Commit
e5b4b198
authored
Aug 31, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Port more softwares to python 3
See merge request
!1238
parents
7d78a928
dc703207
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
108 additions
and
105 deletions
+108
-105
software/html5as/buildout.hash.cfg
software/html5as/buildout.hash.cfg
+2
-2
software/html5as/instance.cfg.in
software/html5as/instance.cfg.in
+1
-1
software/html5as/instance_replicate.cfg.in
software/html5as/instance_replicate.cfg.in
+2
-2
software/html5as/test/test.py
software/html5as/test/test.py
+47
-31
software/htmlvalidatorserver/software.cfg
software/htmlvalidatorserver/software.cfg
+0
-2
software/htmlvalidatorserver/test/test.py
software/htmlvalidatorserver/test/test.py
+0
-1
software/jstestnode/buildout.hash.cfg
software/jstestnode/buildout.hash.cfg
+1
-1
software/jstestnode/runTestSuite.in
software/jstestnode/runTestSuite.in
+12
-12
software/jstestnode/software.cfg
software/jstestnode/software.cfg
+0
-3
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+3
-3
software/ors-amarisoft/instance-enb-epc.jinja2.cfg
software/ors-amarisoft/instance-enb-epc.jinja2.cfg
+2
-2
software/ors-amarisoft/instance-epc.jinja2.cfg
software/ors-amarisoft/instance-epc.jinja2.cfg
+1
-1
software/ors-amarisoft/instance-gnb-epc.jinja2.cfg
software/ors-amarisoft/instance-gnb-epc.jinja2.cfg
+2
-2
software/ors-amarisoft/software.cfg
software/ors-amarisoft/software.cfg
+0
-2
software/seleniumserver/buildout.hash.cfg
software/seleniumserver/buildout.hash.cfg
+1
-1
software/seleniumserver/instance-selenium.cfg.in
software/seleniumserver/instance-selenium.cfg.in
+2
-2
software/seleniumserver/software.cfg
software/seleniumserver/software.cfg
+0
-3
software/seleniumserver/test/test.py
software/seleniumserver/test/test.py
+21
-20
software/slapos-sr-testing/software-py3.cfg
software/slapos-sr-testing/software-py3.cfg
+8
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+0
-8
software/turnserver/software.cfg
software/turnserver/software.cfg
+0
-3
software/turnserver/test/test.py
software/turnserver/test/test.py
+3
-3
No files found.
software/html5as/buildout.hash.cfg
View file @
e5b4b198
...
...
@@ -17,7 +17,7 @@
[template-cfg]
filename = instance.cfg.in
md5sum =
ef264514b64a4b2c77c9965c587c6d34
md5sum =
23c15a579b66cef866b30a2f53b1b737
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
...
...
@@ -45,4 +45,4 @@ md5sum = 1c0ee16966e1fcdb3fd11c09f12ee2b2
[template_instance_replicate]
_update_hash_filename_ = instance_replicate.cfg.in
md5sum =
7ff7e11d05145115f53564ec1af205ef
md5sum =
d7071867625070c27dbd6456c761f9f0
software/html5as/instance.cfg.in
View file @
e5b4b198
...
...
@@ -61,7 +61,7 @@ default = instance-html5as:output
replicate = instance-replicate:output
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
recipe = slapos.cookbook:slapconfiguration
.serialised
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
...
...
software/html5as/instance_replicate.cfg.in
View file @
e5b4b198
...
...
@@ -23,7 +23,7 @@ offline = true
# Macro section sharing request parameters
[instance-request-base]
<= slap-connection
recipe = slapos.cookbook:request
recipe = slapos.cookbook:request
.serialised
# It is the same software as the current one
software-url = ${slap-connection:software-release-url}
# We want the default behaviour
...
...
@@ -51,7 +51,7 @@ sla-computer_guid = {{ parameter_dict["sla-%s-computer-guid" % i] }}
# Publish information to connect to the two instances
[publish-connection-information]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
.serialised
{% for i in range(1, replicate_quantity + 1) %}
instance-{{ i }}-server_url = ${instance-{{ i }}:connection-server_url}
instance-{{ i }}-server-cdn-url = ${instance-{{ i }}:connection-server-cdn-url}
...
...
software/html5as/test/test.py
View file @
e5b4b198
...
...
@@ -25,12 +25,14 @@
#
##############################################################################
import
json
import
os
import
requests
from
urlparse
import
urlparse
from
url
lib.
parse
import
urlparse
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
...
...
@@ -43,8 +45,8 @@ class HTML5ASTestCase(SlapOSInstanceTestCase):
* Install the software release.
* Checks it compile without issue.
* Deploy the instance
* Check deploy
e
ment works and promise pass
For testing the deploy
e
ment a different testing class will need to be set up
* Check deployment works and promise pass
For testing the deployment a different testing class will need to be set up
per each variation of parameters the instance needs to be given.
"""
...
...
@@ -63,11 +65,12 @@ class TestEmptyDeploy(HTML5ASTestCase):
"""
def
test_deploy_with_no_paramater
(
self
):
url
=
self
.
requestDefaultInstance
().
getConnectionParameterDict
(
)[
'server_url'
]
url
=
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
]
)[
'server_url'
]
response
=
self
.
checkUrlAndGetResponse
(
url
)
result
=
response
.
text
self
.
assertFalse
(
"<h1>"
in
result
)
self
.
assertTrue
(
"<p>Hello World</p>"
in
result
)
self
.
assertNotIn
(
"<h1>"
,
result
)
self
.
assertIn
(
"<p>Hello World</p>"
,
result
)
class
TestDeployWithTitle
(
HTML5ASTestCase
):
"""
...
...
@@ -77,17 +80,21 @@ class TestDeployWithTitle(HTML5ASTestCase):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'title'
:
'Test1'
,
'_'
:
json
.
dumps
(
{
'title'
:
'Test1'
,
}
)
}
def
test_deploy_with_title_parameter
(
self
):
connection_parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
(
)
connection_parameter_dict
=
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
]
)
self
.
assertEqual
(
connection_parameter_dict
[
"title"
],
"Title Test1!"
)
url
=
connection_parameter_dict
[
'server_url'
]
response
=
self
.
checkUrlAndGetResponse
(
url
)
result
=
response
.
text
self
.
assert
True
(
"<h1>Test1</h1>"
in
result
)
self
.
assert
True
(
"<p>Hello World</p>"
in
result
)
self
.
assert
In
(
"<h1>Test1</h1>"
,
result
)
self
.
assert
In
(
"<p>Hello World</p>"
,
result
)
class
TestGracefulWithPortChange
(
HTML5ASTestCase
):
"""
...
...
@@ -95,7 +102,9 @@ class TestGracefulWithPortChange(HTML5ASTestCase):
"""
instance_parameter_dict
=
{
'port'
:
8087
'_'
:
json
.
dumps
({
'port'
:
8087
})
}
@
classmethod
...
...
@@ -107,23 +116,23 @@ class TestGracefulWithPortChange(HTML5ASTestCase):
This test test port change and its application with graceful restart
"""
# Check initial connection parameter match expected port
url
=
self
.
computer_partition
.
getConnectionParameterDict
(
)[
'server_url'
]
url
=
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
]
)[
'server_url'
]
self
.
assertEqual
(
urlparse
(
url
).
port
,
8087
)
# Check port is listening even thought it is duplicated with the promise:
# "port-listening-promise"
self
.
checkUrlAndGetResponse
(
url
)
# Update port parameter
self
.
instance_parameter_dict
.
update
({
'port'
:
8086
,
self
.
instance_parameter_dict
[
'_'
]
=
json
.
dumps
({
'port'
:
8086
})
# Request instance with the new port parameter
self
.
requestDefaultInstance
()
# Reprocess the instance to apply new port and run promises
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
# Rerequest instance to get update connection parameter
url
=
self
.
requestDefaultInstance
().
getConnectionParameterDict
(
)[
'server_url'
]
# Re
-
request instance to get update connection parameter
url
=
json
.
loads
(
self
.
requestDefaultInstance
().
getConnectionParameterDict
()[
'_'
]
)[
'server_url'
]
# Make sure the new port is the one being used
self
.
assertEqual
(
urlparse
(
url
).
port
,
8086
)
...
...
@@ -138,8 +147,10 @@ class TestReplicateHTML5AS(HTML5ASTestCase):
"""
instance_parameter_dict
=
{
"port-1"
:
8088
,
"title-1"
:
"Title 1"
,
'_'
:
json
.
dumps
({
"port-1"
:
8088
,
"title-1"
:
"Title 1"
,
})
}
@
classmethod
...
...
@@ -151,32 +162,37 @@ class TestReplicateHTML5AS(HTML5ASTestCase):
return
cls
.
instance_parameter_dict
def
test_replicate_instance
(
self
):
# Check First instance is deployed with proper parameters
connection_parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
(
)
# Check First instance is deployed with proper parameters
connection_parameter_dict
=
json
.
loads
(
self
.
computer_partition
.
getConnectionParameterDict
()[
'_'
]
)
url
=
connection_parameter_dict
[
'instance-1-server_url'
]
self
.
assertEqual
(
urlparse
(
url
).
port
,
8088
)
response
=
self
.
checkUrlAndGetResponse
(
url
)
result
=
response
.
text
self
.
assert
True
(
"<h1>Title 1</h1>"
in
result
)
self
.
assert
In
(
"<h1>Title 1</h1>"
,
result
)
# Check only one instance is deployed by default
self
.
assert
True
(
"instance-2-server_url"
not
in
connection_parameter_dict
)
self
.
assert
NotIn
(
"instance-2-server_url"
,
connection_parameter_dict
)
# Update replicate quantity parameter
self
.
instance_parameter_dict
.
update
({
'replicate-quantity'
:
2
,
'port-2'
:
8089
,
'sla-2-computer_guid'
:
self
.
slap
.
_computer_id
,
"title-2"
:
"Title 314"
,
})
self
.
instance_parameter_dict
[
'_'
]
=
json
.
dumps
(
dict
(
json
.
loads
(
self
.
instance_parameter_dict
[
'_'
]),
**
{
'replicate-quantity'
:
2
,
'port-2'
:
8089
,
'sla-2-computer_guid'
:
self
.
slap
.
_computer_id
,
"title-2"
:
"Title 314"
,
}
)
)
# Request instance with the one more replicate
self
.
requestDefaultInstance
()
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
# Check the second replicate
connection_parameter_dict
=
self
.
requestDefaultInstance
().
getConnectionParameterDict
(
)
connection_parameter_dict
=
json
.
loads
(
self
.
requestDefaultInstance
().
getConnectionParameterDict
()[
'_'
]
)
url
=
connection_parameter_dict
[
'instance-2-server_url'
]
self
.
assertEqual
(
urlparse
(
url
).
port
,
8089
)
response
=
self
.
checkUrlAndGetResponse
(
url
)
result
=
response
.
text
self
.
assert
True
(
"<h1>Title 314</h1>"
in
result
)
self
.
assert
In
(
"<h1>Title 314</h1>"
,
result
)
software/htmlvalidatorserver/software.cfg
View file @
e5b4b198
...
...
@@ -45,7 +45,5 @@ url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/template.cfg
[versions]
# 1.3.4nxd2 is invalid version string, thus pached version string is not '1.3.4nxd2+SlapOSPatched001'
# but '1.3.4nxd2-SlapOSPatched001'.
gunicorn = 19.1.1
inotifyx = 0.2.2
software/htmlvalidatorserver/test/test.py
View file @
e5b4b198
...
...
@@ -41,7 +41,6 @@ class TestHtmlValidatorServer(InstanceTestCase):
def
test
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
# Check that there is a RSS feed
self
.
assertTrue
(
'vnu-url'
in
parameter_dict
)
self
.
assertEqual
(
'https://[%s]:8899/'
%
(
self
.
_ipv6_address
,
),
...
...
software/jstestnode/buildout.hash.cfg
View file @
e5b4b198
...
...
@@ -27,4 +27,4 @@ md5sum = 98faa5ad8cfb23a11d97a459078a1d05
[template-runTestSuite]
filename = runTestSuite.in
md5sum =
70d10e7005b98620ddbbf30030b08198
md5sum =
54d585d50a3464100611774db68b72c0
software/jstestnode/runTestSuite.in
View file @
e5b4b198
...
...
@@ -33,7 +33,7 @@ def main():
parser = argparse.ArgumentParser(description='Run a test suite.')
parser.add_argument('--test_suite', help='The test suite name',
default=parsed_parameters.get('test-suite', ''),
required=
not parsed_parameters.has_key('test-suite')
)
required=
'test-suite' not in parsed_parameters
)
parser.add_argument('--test_suite_title', help='The test suite title')
parser.add_argument('--test_node_title', help='The test node title')
parser.add_argument('--project_title', help='The project title')
...
...
@@ -96,7 +96,7 @@ def main():
firefox_binary='${firefox-wrapper-68:location}',
executable_path='${geckodriver:location}')
else:
assert target == 'selenium-server',
"Unsupported target {}".format(test_runner['target'])
assert target == 'selenium-server',
f"Unsupported target {test_runner['target']}"
# use a remote connection which optionally verifies TLS certificate
# and optionally against a user provided CA.
executor = RemoteConnection(test_runner['server-url'], keep_alive=True)
...
...
@@ -120,14 +120,14 @@ def main():
remote_access_url = parsed_parameters.get('remote-access-url')
if remote_access_url:
if ('jio' in test_suite):
url =
'{}/jio/test/tests.html'.format(remote_access_url)
url =
f'{remote_access_url}/jio/test/tests.html'
else:
url =
'{}/renderjs/test/'.format(remote_access_url)
url =
f'{remote_access_url}/renderjs/test'
is_browser_running = True
agent = browser.execute_script("return navigator.userAgent")
print
agent
print
url
print
(agent)
print
(url)
browser.get(url)
WebDriverWait(browser, 300).until(EC.presence_of_element_located((
...
...
@@ -137,7 +137,7 @@ def main():
html_parser = etree.HTMLParser(recover=True)
body = etree.fromstring(browser.page_source.encode('UTF-8'), html_parser)
print
' '.join(body.xpath('//*[@id="qunit-testresult"]//text()'
))
print
(' '.join(body.xpath('//*[@id="qunit-testresult"]//text()')
))
for elt in body.xpath('.//ol[@id="qunit-tests"]/li'):
if (len(elt.xpath('.//span[@class="module-name"]'))):
...
...
@@ -149,7 +149,7 @@ def main():
else:
test_name = elt.xpath('.//span[@class="test-name"]')[0].text
print
elt.get('class'), ''.join(elt.xpath('.//strong')[0].itertext(
))
print
(elt.get('class'), ''.join(elt.xpath('.//strong')[0].itertext()
))
# print elt.find_element_by_tag_name('ol').get_attribute('innerHTML')
failure = int(elt.xpath('.//b[@class="failed"]')[0].text)
...
...
@@ -176,7 +176,7 @@ def main():
# Send results
tool = taskdistribution.TaskDistributor(portal_url=args.master_url)
test_result = tool.createTestResult(revision = revision,
test_name_list =
test_line_dict.keys(
),
test_name_list =
list(test_line_dict.keys()
),
node_title = args.test_node_title,
test_title = test_suite_title,
project_title = args.project_title)
...
...
@@ -186,17 +186,17 @@ def main():
while 1:
test_result_line = test_result.start()
if not test_result_line:
print
'No test result anymore.'
print
('No test result anymore.')
break
print
'Submitting: "%s"' % test_result_line.name
print
('Submitting: "%s"' % test_result_line.name)
# report status back to Nexedi ERP5
test_result_line.stop(**test_line_dict[test_result_line.name])
except:
# Catch any exception here, to warn user instead of being silent,
# by generating fake error result
print
traceback.format_exc(
)
print
(traceback.format_exc()
)
result = dict(status_code=-1,
command=url,
stderr=traceback.format_exc(),
...
...
software/jstestnode/software.cfg
View file @
e5b4b198
...
...
@@ -29,9 +29,6 @@ parts =
openssl
instance
[python]
part = python2.7
[nodejs]
<= nodejs-14.16.0
...
...
software/ors-amarisoft/buildout.hash.cfg
View file @
e5b4b198
...
...
@@ -20,7 +20,7 @@ md5sum = fc7bccab64e6794b33766ca9925231c8
[template-lte-enb-epc]
_update_hash_filename_ = instance-enb-epc.jinja2.cfg
md5sum =
b10c10a9408a934052fd0960f31a75f
c
md5sum =
c9994f2ef03edd7d6773307a6385c47
c
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
...
...
@@ -28,11 +28,11 @@ md5sum = c450b8c307d20738a98bcb4f6ffeee16
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
md5sum =
5f86177e7ef18a6046826f96397ded1d
md5sum =
4b27f60eab8d71c2c47f21a845fddb47
[template-lte-epc]
_update_hash_filename_ = instance-epc.jinja2.cfg
md5sum =
2cfe5679374559ab94478b987d646d83
md5sum =
b17674f523adce9b0dda942c1493674d
[template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
...
...
software/ors-amarisoft/instance-enb-epc.jinja2.cfg
View file @
e5b4b198
...
...
@@ -51,7 +51,7 @@ config-monitor-password = ${monitor-htpasswd:passwd}
name = MME
software-type = mme
config-name = mme
{%- for key, value in slapparameter_dict.ite
rite
ms() %}
{%- for key, value in slapparameter_dict.items() %}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-slave-list = {{ dumps(slave_instance_list) }}
...
...
@@ -62,7 +62,7 @@ return = monitor-base-url epc-ipv6
name = eNB
software-type = enb
config-name = enb
{%- for key, value in slapparameter_dict.ite
rite
ms() %}
{%- for key, value in slapparameter_dict.items() %}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
return = monitor-base-url
...
...
software/ors-amarisoft/instance-epc.jinja2.cfg
View file @
e5b4b198
...
...
@@ -51,7 +51,7 @@ return = monitor-base-url epc-ipv6
name = MME
software-type = mme
config-name = mme
{%- for key, value in slapparameter_dict.ite
rite
ms() %}
{%- for key, value in slapparameter_dict.items() %}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-slave-list = {{ dumps(slave_instance_list) }}
...
...
software/ors-amarisoft/instance-gnb-epc.jinja2.cfg
View file @
e5b4b198
...
...
@@ -51,7 +51,7 @@ config-monitor-password = ${monitor-htpasswd:passwd}
name = MME
software-type = mme
config-name = mme
{%- for key, value in slapparameter_dict.ite
rite
ms() %}
{%- for key, value in slapparameter_dict.items() %}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-slave-list = {{ dumps(slave_instance_list) }}
...
...
@@ -62,7 +62,7 @@ return = monitor-base-url epc-ipv6
name = gNB
software-type = gnb
config-name = gnb
{%- for key, value in slapparameter_dict.ite
rite
ms() %}
{%- for key, value in slapparameter_dict.items() %}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
return = monitor-base-url
...
...
software/ors-amarisoft/software.cfg
View file @
e5b4b198
...
...
@@ -21,8 +21,6 @@ parts +=
# apache-php
# logrotate
[python]
part = python2.7
[template]
recipe = slapos.recipe.template
...
...
software/seleniumserver/buildout.hash.cfg
View file @
e5b4b198
...
...
@@ -19,4 +19,4 @@ md5sum = 9b41238f67ea8e12f8ea9590fd552b33
[template-selenium]
filename = instance-selenium.cfg.in
md5sum =
3e50d629307ca9f1381909102a52756d
md5sum =
9b4742e8a249aef38c7c8c12d74b0605
software/seleniumserver/instance-selenium.cfg.in
View file @
e5b4b198
...
...
@@ -316,10 +316,10 @@ recipe = slapos.recipe.template
output = $${directory:bin}/$${:_buildout_section_name_}
inline =
#!${buildout:executable}
import json, urllib, sys
import json, urllib
.request
, sys
api_url = sys.argv[1]
expected_node_count = int(sys.argv[2])
actual_node_count = json.load(urllib.urlopen(api_url))['slotCounts']['total']
actual_node_count = json.load(urllib.
request.
urlopen(api_url))['slotCounts']['total']
sys.exit(0 if expected_node_count == actual_node_count else 1)
...
...
software/seleniumserver/software.cfg
View file @
e5b4b198
...
...
@@ -23,9 +23,6 @@ parts =
collective.recipe.shelloutput
template
[python]
part = python2.7
[collective.recipe.shelloutput]
recipe = zc.recipe.egg
...
...
software/seleniumserver/test/test.py
View file @
e5b4b198
...
...
@@ -31,12 +31,12 @@ import multiprocessing
import
os
import
tempfile
import
unittest
import
urlparse
import
url
lib.
parse
import
base64
import
hashlib
import
logging
import
contextlib
from
BaseHTTPS
erver
import
BaseHTTPRequestHandler
from
http.s
erver
import
BaseHTTPRequestHandler
from
io
import
BytesIO
...
...
@@ -72,7 +72,7 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
end_headers
()
self
.
wfile
.
write
(
'''
b
'''
<html>
<title>Test page</title>
<body>
...
...
@@ -97,15 +97,15 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
end_headers
()
file_data
=
'no file'
if
form
.
has_key
(
'f'
)
:
file_data
=
form
[
'f'
].
file
.
read
()
if
'f'
in
form
:
file_data
=
form
[
'f'
].
file
.
read
()
.
decode
()
self
.
wfile
.
write
(
'''
(
'''
<html>
<title>%s</title>
<div>%s</div>
</html>
'''
%
(
form
[
'q'
].
value
,
file_data
))
'''
%
(
form
[
'q'
].
value
,
file_data
))
.
encode
())
log_message
=
logging
.
getLogger
(
__name__
+
'.WebServer'
).
info
...
...
@@ -148,7 +148,7 @@ class BrowserCompatibilityMixin(WebServerMixin):
WebDriverWait
(
self
.
driver
,
3
).
until
(
EC
.
title_is
(
self
.
id
()))
def
test_upload_file
(
self
):
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
mode
=
'w'
)
f
.
write
(
self
.
id
())
f
.
close
()
self
.
addCleanup
(
lambda
:
os
.
remove
(
f
.
name
))
...
...
@@ -307,7 +307,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
admin_url
=
parameter_dict
[
'admin-url'
]
parsed
=
urlparse
.
urlparse
(
admin_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
admin_url
)
self
.
assertEqual
(
'admin'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
...
...
@@ -316,7 +316,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
def
test_browser_use_hub
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
webdriver_url
=
parameter_dict
[
'url'
]
parsed
=
urlparse
.
urlparse
(
webdriver_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
webdriver_url
)
self
.
assertEqual
(
'selenium'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
...
...
@@ -343,7 +343,7 @@ class TestSSHServer(SeleniumServerTestCase):
def
test_connect
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
ssh_url
=
parameter_dict
[
'ssh-url'
]
parsed
=
urlparse
.
urlparse
(
ssh_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
ssh_url
)
self
.
assertEqual
(
'ssh'
,
parsed
.
scheme
)
client
=
paramiko
.
SSHClient
()
...
...
@@ -359,9 +359,9 @@ class TestSSHServer(SeleniumServerTestCase):
with
contextlib
.
closing
(
client
):
client
.
connect
(
username
=
urlparse
.
urlparse
(
ssh_url
).
username
,
hostname
=
urlparse
.
urlparse
(
ssh_url
).
hostname
,
port
=
urlparse
.
urlparse
(
ssh_url
).
port
,
username
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
username
,
hostname
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
hostname
,
port
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
port
,
pkey
=
self
.
ssh_key
,
)
...
...
@@ -378,7 +378,7 @@ class TestSSHServer(SeleniumServerTestCase):
# Paramiko does not allow to get the fingerprint as SHA256 easily yet
# https://github.com/paramiko/paramiko/pull/1103
self
.
assertEqual
(
fingerprint
,
fingerprint
.
encode
()
,
# XXX with sha256, we need to remove that trailing =
base64
.
b64encode
(
hashlib
.
new
(
fingerprint_algorithm
,
...
...
@@ -386,15 +386,15 @@ class TestSSHServer(SeleniumServerTestCase):
channel
=
client
.
invoke_shell
()
channel
.
settimeout
(
30
)
received
=
''
received
=
b
''
while
True
:
r
=
channel
.
recv
(
1024
)
if
not
r
:
break
received
+=
r
if
'Selenium Server.'
in
received
:
if
b
'Selenium Server.'
in
received
:
break
self
.
assertIn
(
"Welcome to SlapOS Selenium Server."
,
received
)
self
.
assertIn
(
b
"Welcome to SlapOS Selenium Server."
,
received
)
class
TestFirefox52
(
...
...
@@ -405,8 +405,9 @@ class TestFirefox52(
desired_capabilities
=
dict
(
DesiredCapabilities
.
FIREFOX
,
version
=
'52.9.0esr'
)
user_agent
=
'Gecko/20100101 Firefox/52.0'
# resizing window is not supported on firefox 52 geckodriver
test_resize_window
=
unittest
.
expectedFailure
(
BrowserCompatibilityMixin
.
test_resize_window
)
@
unittest
.
expectedFailure
def
test_resize_window
(
self
):
super
().
test_resize_window
()
class
TestFirefox60
(
...
...
software/slapos-sr-testing/software-py3.cfg
View file @
e5b4b198
...
...
@@ -16,18 +16,26 @@ extra =
caddy-frontend ${slapos.test.caddy-frontend-setup:setup}
erp5testnode ${slapos.test.erp5testnode-setup:setup}
galene ${slapos.test.galene-setup:setup}
grafana ${slapos.test.grafana-setup:setup}
headless-chromium ${slapos.test.headless-chromium-setup:setup}
helloworld ${slapos.test.helloworld-setup:setup}
html5as ${slapos.test.html5as-setup:setup}
html5as-base ${slapos.test.html5as-base-setup:setup}
hugo ${slapos.test.hugo-setup:setup}
jstestnode ${slapos.test.jstestnode-setup:setup}
jupyter ${slapos.test.jupyter-setup:setup}
kvm ${slapos.test.kvm-setup:setup}
matomo ${slapos.test.matomo-setup:setup}
metabase ${slapos.test.metabase-setup:setup}
monitor ${slapos.test.monitor-setup:setup}
nextcloud ${slapos.test.nextcloud-setup:setup}
nginx-push-stream ${slapos.test.nginx-push-stream-setup:setup}
ors-amarisoft ${slapos.test.ors-amarisoft-setup:setup}
plantuml ${slapos.test.plantuml-setup:setup}
powerdns ${slapos.test.powerdns-setup:setup}
proftpd ${slapos.test.proftpd-setup:setup}
repman ${slapos.test.repman-setup:setup}
restic-rest-server ${slapos.test.restic_rest_server-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
software/slapos-sr-testing/software.cfg
View file @
e5b4b198
...
...
@@ -359,8 +359,6 @@ tests =
# here, to check there's no promise issue when slapos node runs with Python 2.
erp5 ${slapos.test.erp5-setup:setup}
fluentd ${slapos.test.fluentd-setup:setup}
metabase ${slapos.test.metabase-setup:setup}
ors-amarisoft ${slapos.test.ors-amarisoft-setup:setup}
###
${:extra}
...
...
@@ -373,17 +371,11 @@ extra =
cloudooo ${slapos.test.cloudooo-setup:setup}
dream ${slapos.test.dream-setup:setup}
gitlab ${slapos.test.gitlab-setup:setup}
grafana ${slapos.test.grafana-setup:setup}
html5as ${slapos.test.html5as-setup:setup}
html5as-base ${slapos.test.html5as-base-setup:setup}
htmlvalidatorserver ${slapos.test.htmlvalidatorserver-setup:setup}
jscrawler ${slapos.test.jscrawler-setup:setup}
jstestnode ${slapos.test.jstestnode-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
slapos-master ${slapos.test.slapos-master-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
upgrade_erp5 ${slapos.test.upgrade_erp5-setup:setup}
[versions]
...
...
software/turnserver/software.cfg
View file @
e5b4b198
...
...
@@ -14,9 +14,6 @@ parts =
coturn
instance-cfg
[python]
part = python2.7
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
...
...
software/turnserver/test/test.py
View file @
e5b4b198
...
...
@@ -29,7 +29,7 @@ import os
import
subprocess
import
json
import
glob
import
ConfigP
arser
import
configp
arser
from
slapos.recipe.librecipe
import
generateHashFromFiles
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
...
...
@@ -96,7 +96,7 @@ class TestServices(TurnServerTestCase):
secret_file
=
os
.
path
.
join
(
self
.
partition_path
,
'etc/.turnsecret'
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
partition_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
secret_file
))
config
=
ConfigP
arser
.
ConfigParser
()
config
=
configp
arser
.
ConfigParser
()
with
open
(
secret_file
)
as
f
:
config
.
readfp
(
f
)
secret
=
config
.
get
(
'turnserver'
,
'secret'
)
...
...
@@ -151,7 +151,7 @@ class TestParameters(TurnServerTestCase):
secret_file
=
os
.
path
.
join
(
self
.
partition_path
,
'etc/.turnsecret'
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
partition_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
secret_file
))
config
=
ConfigP
arser
.
ConfigParser
()
config
=
configp
arser
.
ConfigParser
()
with
open
(
secret_file
)
as
f
:
config
.
readfp
(
f
)
secret
=
config
.
get
(
'turnserver'
,
'secret'
)
...
...
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