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
Labels
Merge Requests
107
Merge Requests
107
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
ef438d81
Commit
ef438d81
authored
Aug 27, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/seleniumserver: port to python3
parent
fed05f8c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
22 deletions
+22
-22
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/test/test.py
software/seleniumserver/test/test.py
+18
-18
software/slapos-sr-testing/software-py3.cfg
software/slapos-sr-testing/software-py3.cfg
+1
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+0
-1
No files found.
software/seleniumserver/buildout.hash.cfg
View file @
ef438d81
...
@@ -19,4 +19,4 @@ md5sum = 9b41238f67ea8e12f8ea9590fd552b33
...
@@ -19,4 +19,4 @@ md5sum = 9b41238f67ea8e12f8ea9590fd552b33
[template-selenium]
[template-selenium]
filename = instance-selenium.cfg.in
filename = instance-selenium.cfg.in
md5sum =
3e50d629307ca9f1381909102a52756d
md5sum =
9b4742e8a249aef38c7c8c12d74b0605
software/seleniumserver/instance-selenium.cfg.in
View file @
ef438d81
...
@@ -316,10 +316,10 @@ recipe = slapos.recipe.template
...
@@ -316,10 +316,10 @@ recipe = slapos.recipe.template
output = $${directory:bin}/$${:_buildout_section_name_}
output = $${directory:bin}/$${:_buildout_section_name_}
inline =
inline =
#!${buildout:executable}
#!${buildout:executable}
import json, urllib, sys
import json, urllib
.request
, sys
api_url = sys.argv[1]
api_url = sys.argv[1]
expected_node_count = int(sys.argv[2])
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)
sys.exit(0 if expected_node_count == actual_node_count else 1)
...
...
software/seleniumserver/test/test.py
View file @
ef438d81
...
@@ -31,12 +31,12 @@ import multiprocessing
...
@@ -31,12 +31,12 @@ import multiprocessing
import
os
import
os
import
tempfile
import
tempfile
import
unittest
import
unittest
import
urlparse
import
url
lib.
parse
import
base64
import
base64
import
hashlib
import
hashlib
import
logging
import
logging
import
contextlib
import
contextlib
from
BaseHTTPS
erver
import
BaseHTTPRequestHandler
from
http.s
erver
import
BaseHTTPRequestHandler
from
io
import
BytesIO
from
io
import
BytesIO
...
@@ -72,7 +72,7 @@ class WebServer(ManagedHTTPServer):
...
@@ -72,7 +72,7 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
send_response
(
200
)
self
.
end_headers
()
self
.
end_headers
()
self
.
wfile
.
write
(
self
.
wfile
.
write
(
'''
b
'''
<html>
<html>
<title>Test page</title>
<title>Test page</title>
<body>
<body>
...
@@ -97,15 +97,15 @@ class WebServer(ManagedHTTPServer):
...
@@ -97,15 +97,15 @@ class WebServer(ManagedHTTPServer):
self
.
send_response
(
200
)
self
.
send_response
(
200
)
self
.
end_headers
()
self
.
end_headers
()
file_data
=
'no file'
file_data
=
'no file'
if
form
.
has_key
(
'f'
)
:
if
'f'
in
form
:
file_data
=
form
[
'f'
].
file
.
read
()
file_data
=
form
[
'f'
].
file
.
read
()
.
decode
()
self
.
wfile
.
write
(
self
.
wfile
.
write
(
'''
(
'''
<html>
<html>
<title>%s</title>
<title>%s</title>
<div>%s</div>
<div>%s</div>
</html>
</html>
'''
%
(
form
[
'q'
].
value
,
file_data
))
'''
%
(
form
[
'q'
].
value
,
file_data
))
.
encode
())
log_message
=
logging
.
getLogger
(
__name__
+
'.WebServer'
).
info
log_message
=
logging
.
getLogger
(
__name__
+
'.WebServer'
).
info
...
@@ -148,7 +148,7 @@ class BrowserCompatibilityMixin(WebServerMixin):
...
@@ -148,7 +148,7 @@ class BrowserCompatibilityMixin(WebServerMixin):
WebDriverWait
(
self
.
driver
,
3
).
until
(
EC
.
title_is
(
self
.
id
()))
WebDriverWait
(
self
.
driver
,
3
).
until
(
EC
.
title_is
(
self
.
id
()))
def
test_upload_file
(
self
):
def
test_upload_file
(
self
):
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
f
=
tempfile
.
NamedTemporaryFile
(
delete
=
False
,
mode
=
'w'
)
f
.
write
(
self
.
id
())
f
.
write
(
self
.
id
())
f
.
close
()
f
.
close
()
self
.
addCleanup
(
lambda
:
os
.
remove
(
f
.
name
))
self
.
addCleanup
(
lambda
:
os
.
remove
(
f
.
name
))
...
@@ -307,7 +307,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
...
@@ -307,7 +307,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
admin_url
=
parameter_dict
[
'admin-url'
]
admin_url
=
parameter_dict
[
'admin-url'
]
parsed
=
urlparse
.
urlparse
(
admin_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
admin_url
)
self
.
assertEqual
(
'admin'
,
parsed
.
username
)
self
.
assertEqual
(
'admin'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
self
.
assertTrue
(
parsed
.
password
)
...
@@ -316,7 +316,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
...
@@ -316,7 +316,7 @@ class TestFrontend(WebServerMixin, SeleniumServerTestCase):
def
test_browser_use_hub
(
self
):
def
test_browser_use_hub
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
webdriver_url
=
parameter_dict
[
'url'
]
webdriver_url
=
parameter_dict
[
'url'
]
parsed
=
urlparse
.
urlparse
(
webdriver_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
webdriver_url
)
self
.
assertEqual
(
'selenium'
,
parsed
.
username
)
self
.
assertEqual
(
'selenium'
,
parsed
.
username
)
self
.
assertTrue
(
parsed
.
password
)
self
.
assertTrue
(
parsed
.
password
)
...
@@ -343,7 +343,7 @@ class TestSSHServer(SeleniumServerTestCase):
...
@@ -343,7 +343,7 @@ class TestSSHServer(SeleniumServerTestCase):
def
test_connect
(
self
):
def
test_connect
(
self
):
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
parameter_dict
=
self
.
computer_partition
.
getConnectionParameterDict
()
ssh_url
=
parameter_dict
[
'ssh-url'
]
ssh_url
=
parameter_dict
[
'ssh-url'
]
parsed
=
urlparse
.
urlparse
(
ssh_url
)
parsed
=
url
lib
.
parse
.
urlparse
(
ssh_url
)
self
.
assertEqual
(
'ssh'
,
parsed
.
scheme
)
self
.
assertEqual
(
'ssh'
,
parsed
.
scheme
)
client
=
paramiko
.
SSHClient
()
client
=
paramiko
.
SSHClient
()
...
@@ -359,9 +359,9 @@ class TestSSHServer(SeleniumServerTestCase):
...
@@ -359,9 +359,9 @@ class TestSSHServer(SeleniumServerTestCase):
with
contextlib
.
closing
(
client
):
with
contextlib
.
closing
(
client
):
client
.
connect
(
client
.
connect
(
username
=
urlparse
.
urlparse
(
ssh_url
).
username
,
username
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
username
,
hostname
=
urlparse
.
urlparse
(
ssh_url
).
hostname
,
hostname
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
hostname
,
port
=
urlparse
.
urlparse
(
ssh_url
).
port
,
port
=
url
lib
.
parse
.
urlparse
(
ssh_url
).
port
,
pkey
=
self
.
ssh_key
,
pkey
=
self
.
ssh_key
,
)
)
...
@@ -378,7 +378,7 @@ class TestSSHServer(SeleniumServerTestCase):
...
@@ -378,7 +378,7 @@ class TestSSHServer(SeleniumServerTestCase):
# Paramiko does not allow to get the fingerprint as SHA256 easily yet
# Paramiko does not allow to get the fingerprint as SHA256 easily yet
# https://github.com/paramiko/paramiko/pull/1103
# https://github.com/paramiko/paramiko/pull/1103
self
.
assertEqual
(
self
.
assertEqual
(
fingerprint
,
fingerprint
.
encode
()
,
# XXX with sha256, we need to remove that trailing =
# XXX with sha256, we need to remove that trailing =
base64
.
b64encode
(
base64
.
b64encode
(
hashlib
.
new
(
fingerprint_algorithm
,
hashlib
.
new
(
fingerprint_algorithm
,
...
@@ -386,15 +386,15 @@ class TestSSHServer(SeleniumServerTestCase):
...
@@ -386,15 +386,15 @@ class TestSSHServer(SeleniumServerTestCase):
channel
=
client
.
invoke_shell
()
channel
=
client
.
invoke_shell
()
channel
.
settimeout
(
30
)
channel
.
settimeout
(
30
)
received
=
''
received
=
b
''
while
True
:
while
True
:
r
=
channel
.
recv
(
1024
)
r
=
channel
.
recv
(
1024
)
if
not
r
:
if
not
r
:
break
break
received
+=
r
received
+=
r
if
'Selenium Server.'
in
received
:
if
b
'Selenium Server.'
in
received
:
break
break
self
.
assertIn
(
"Welcome to SlapOS Selenium Server."
,
received
)
self
.
assertIn
(
b
"Welcome to SlapOS Selenium Server."
,
received
)
class
TestFirefox52
(
class
TestFirefox52
(
...
...
software/slapos-sr-testing/software-py3.cfg
View file @
ef438d81
...
@@ -30,4 +30,5 @@ extra =
...
@@ -30,4 +30,5 @@ extra =
proftpd ${slapos.test.proftpd-setup:setup}
proftpd ${slapos.test.proftpd-setup:setup}
repman ${slapos.test.repman-setup:setup}
repman ${slapos.test.repman-setup:setup}
restic-rest-server ${slapos.test.restic_rest_server-setup:setup}
restic-rest-server ${slapos.test.restic_rest_server-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
theia ${slapos.test.theia-setup:setup}
software/slapos-sr-testing/software.cfg
View file @
ef438d81
...
@@ -380,7 +380,6 @@ extra =
...
@@ -380,7 +380,6 @@ extra =
jscrawler ${slapos.test.jscrawler-setup:setup}
jscrawler ${slapos.test.jscrawler-setup:setup}
jstestnode ${slapos.test.jstestnode-setup:setup}
jstestnode ${slapos.test.jstestnode-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
slapos-master ${slapos.test.slapos-master-setup:setup}
slapos-master ${slapos.test.slapos-master-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
...
...
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