Skip to content

Commit 1cc4a67

Browse files
committed
Support endpoint with '/' at the end.
1. Support endpoint with '/' at the end. 2. Change the doc in config.py for tests and examples.
1 parent b3c0f28 commit 1cc4a67

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

examples/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
#
1313
# The default settings below are sufficient if the Cloud Simulator has been
1414
# started on the endpoint, localhost:8080, which is its default. If not, the
15-
# parameters in this file should be changed as needed.
15+
# parameters in this file should be changed as needed. Please see sample config
16+
# options in: config_cloudsim.py, config_onprem.py and config_cloud.py, change
17+
# the parameters in those files, then copy the content to this file.
1618
#
1719

1820
# The endpoint to use to connect to the service. This endpoint is for a Cloud
1921
# Simulator running on its default port (8080) on the local machine.
2022
endpoint = 'localhost:8080'
2123

22-
# The server type, please don't change it.
24+
# The server type.
2325
server_type = 'cloudsim'

src/borneo/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ def create_url(endpoint, path):
12121212

12131213
# Strip out any slashes if the format was protocol://host[:port]
12141214
if host.startswith('//'):
1215-
host = host[2:]
1215+
host = host.lstrip('/')
12161216

12171217
if protocol != 'http' and protocol != 'https':
12181218
raise IllegalArgumentException(
@@ -1223,6 +1223,8 @@ def create_url(endpoint, path):
12231223
def validate_port(endpoint, portstring):
12241224
# Check that a port is a valid, non negative integer.
12251225
try:
1226+
# Strip out any slashes after the port string.
1227+
portstring = portstring.rstrip('/')
12261228
port = int(portstring)
12271229
CheckValue.check_int_ge_zero(port, 'port')
12281230
return port

test/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
#
1414
# The default settings below are sufficient if the Cloud Simulator has been
1515
# started on the endpoint, localhost:8080, which is its default. If not, the
16-
# parameters in this file should be changed as needed.
16+
# parameters in this file should be changed as needed. Please see sample config
17+
# options in: config_cloudsim.py and config_onprem.py, change the parameters
18+
# in those files, then copy the content to this file.
1719
#
1820

1921
# The endpoint to use to connect to the service. This endpoint is for a Cloud
2022
# Simulator running on its default port (8080) on the local machine.
2123
endpoint = 'localhost:8080'
2224

23-
# The server type, please don't change it.
25+
# The server type.
2426
server_type = 'cloudsim'
2527

2628
# Cloud Simulator version. Use None to test with the latest Cloud Simulator

test/query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ def testQueryStatementSelectWithMaxReadKb(self):
253253
self.query_request.set_statement(query_statement).set_max_read_kb(
254254
max_read_kb)
255255
result = self.handle.query(self.query_request)
256-
if (is_onprem() and version is not None and
257-
compare_version(version, '20.2.0') == -1):
256+
if is_onprem():
258257
records = self.check_query_result(result, num_records)
259258
else:
260259
records = self.check_query_result(result, max_read_kb + 1, True)

0 commit comments

Comments
 (0)