Skip to content

Commit

Permalink
Revert "Switch external_host to host_ip. (#9258)"
Browse files Browse the repository at this point in the history
This reverts commit 1ccd332.
  • Loading branch information
jgraham committed Feb 23, 2018
1 parent 96bff47 commit 540af07
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config.default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{"host": "web-platform.test",
"doc_root": null,
"ws_doc_root": null,
"host_ip": null,
"external_host": null,
"ports":{"http":[8000, "auto"],
"https":[8443],
"ws":["auto"],
Expand Down
7 changes: 3 additions & 4 deletions tools/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,9 @@ def get_ports(config, ssl_environment):


def normalise_config(config, ports):
host = config["host"]
host = config["external_host"] if config["external_host"] else config["host"]
domains = get_subdomains(host)
not_domains = get_not_subdomains(host)

ports_ = {}
for scheme, ports_used in ports.iteritems():
ports_[scheme] = ports_used
Expand All @@ -667,6 +666,7 @@ def normalise_config(config, ports):
# make a (shallow) copy of the config and update that, so that the
# normalized config can be used in place of the original one.
config_ = config.copy()
config_["host"] = host
config_["domains"] = domains
config_["not_domains"] = not_domains
config_["ports"] = ports_
Expand All @@ -685,9 +685,8 @@ def get_ssl_config(config, ssl_environment):
"cert_path": cert_path,
"encrypt_after_connect": config["ssl"]["encrypt_after_connect"]}


def start(config, ssl_environment, routes, **kwargs):
host = config.get("host_ip", config["host"])
host = config["host"]
ports = get_ports(config, ssl_environment)
paths = get_paths(config)
bind_hostname = config["bind_hostname"]
Expand Down
4 changes: 2 additions & 2 deletions tools/wptrunner/wptrunner/browsers/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def env_options():
# domains to localhost without relying on the network stack.
#
# https://github.com/w3c/web-platform-tests/pull/9480
return {"host_ip": "127.0.0.1",
"host": "web-platform.test",
return {"host": "127.0.0.1",
"external_host": "web-platform.test",
"bind_hostname": "false",
"certificate_domain": "web-platform.test",
"supports_debugger": True}
Expand Down
4 changes: 2 additions & 2 deletions tools/wptrunner/wptrunner/browsers/servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def env_extras(**kwargs):


def env_options():
return {"host": "web-platform.test",
"host_ip": "127.0.0.1",
return {"host": "127.0.0.1",
"external_host": "web-platform.test",
"bind_hostname": False,
"testharnessreport": "testharnessreport-servo.js",
"supports_debugger": True}
Expand Down
4 changes: 2 additions & 2 deletions tools/wptrunner/wptrunner/browsers/servodriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def env_extras(**kwargs):


def env_options():
return {"host_ip": "127.0.0.1",
"host": "web-platform.test",
return {"host": "127.0.0.1",
"external_host": "web-platform.test",
"bind_hostname": "true",
"testharnessreport": "testharnessreport-servodriver.js",
"supports_debugger": True}
Expand Down
16 changes: 7 additions & 9 deletions tools/wptrunner/wptrunner/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def __enter__(self):
cm.__enter__()
self.env_extras_cms.append(cm)

self.servers = serve.start(self.config,
self.ssl_env,
self.servers = serve.start(self.config, self.ssl_env,
self.get_routes())
if self.options.get("supports_debugger") and self.debug_info and self.debug_info.interactive:
self.ignore_interrupts()
Expand Down Expand Up @@ -154,7 +153,9 @@ def load_config(self):
with open(default_config_path) as f:
default_config = json.load(f)

local_config["host_ip"] = self.options.get("host_ip", None)
#TODO: allow non-default configuration for ssl

local_config["external_host"] = self.options.get("external_host", None)
local_config["ssl"]["encrypt_after_connect"] = self.options.get("encrypt_after_connect", False)

config = serve.merge_json(default_config, local_config)
Expand Down Expand Up @@ -229,23 +230,20 @@ def ensure_started(self):
if not failed:
return
time.sleep(0.5)
raise EnvironmentError("Servers failed to start: %s" %
", ".join("%s:%s" % item for item in failed))
raise EnvironmentError("Servers failed to start (scheme:port): %s" % ("%s:%s" for item in failed))

def test_servers(self):
failed = []
host = self.config.get("host_ip") or self.config.get("host")
for scheme, servers in self.servers.iteritems():
for port, server in servers:
if self.test_server_port:
s = socket.socket()
try:
s.connect((host, port))
s.connect((self.config["host"], port))
except socket.error:
failed.append((host, port))
failed.append((scheme, port))
finally:
s.close()

if not server.is_alive():
failed.append((scheme, port))
return failed

0 comments on commit 540af07

Please sign in to comment.