Commit ccc69e4 1 parent ad509e5 commit ccc69e4 Copy full SHA for ccc69e4
File tree 3 files changed +15
-9
lines changed
3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,18 @@ def validate_username(username):
31
31
32
32
33
33
def validate_port (port ):
34
+ if not isinstance (port , basestring ):
35
+ raise ConfigurationError ('Port must be of type string, but found %s.' %
36
+ str (type (port )))
34
37
try :
35
38
port_int = int (port )
36
- except TypeError :
37
- raise ConfigurationError ('Port must be of type string, but '
38
- 'found ' + str (type (port )) + '.' )
39
39
except ValueError :
40
40
raise ConfigurationError ('Invalid value ' + port + ': '
41
41
'port must be a number between 1 and 65535.' )
42
42
if not port_int > 0 or not port_int < 65535 :
43
43
raise ConfigurationError ('Invalid port number ' + port +
44
44
': port must be between 1 and 65535' )
45
- return port_int
45
+ return port
46
46
47
47
48
48
def validate_host (host ):
Original file line number Diff line number Diff line change @@ -351,6 +351,10 @@ def test_install_interactive_with_hostnames(self):
351
351
self .assert_has_default_connector (container )
352
352
self .assert_has_jmx_connector (container )
353
353
354
+ # make sure that we don't get an error when using the written out
355
+ # configs
356
+ self .run_prestoadmin ('server start' )
357
+
354
358
def test_install_interactive_with_ips (self ):
355
359
ips = self .cluster .get_ip_address_dict ()
356
360
rpm_name = self .installer .copy_presto_rpm_to_master ()
Original file line number Diff line number Diff line change @@ -52,16 +52,18 @@ def test_invalid_host_type(self):
52
52
(["my" , "list" ]))
53
53
54
54
def test_valid_port (self ):
55
- port = 1234
55
+ port = ' 1234'
56
56
self .assertEqual (validators .validate_port (port ), port )
57
57
58
+ def test_invalid_port_type (self ):
59
+ self .assertRaisesRegexp (ConfigurationError ,
60
+ "Port must be of type string, "
61
+ "but found <type 'int'>." ,
62
+ validators .validate_port , 1234 )
63
+
58
64
def test_invalid_port (self ):
59
65
self .assertRaisesRegexp (ConfigurationError ,
60
66
"Invalid port number 99999999: port must be "
61
67
"between 1 and 65535" ,
62
68
validators .validate_port ,
63
69
("99999999" ))
64
-
65
- def test_invalid_port_type (self ):
66
- self .assertRaises (ConfigurationError ,
67
- validators .validate_port , (["123" ]))
You can’t perform that action at this time.
0 commit comments