Comments (20)
(The comment about the hostnames are misleading other than the value returned by os.Hostname
is not something you can look up. It was a bad hypothesis that failed under checks with dig
to verify)
from rules_webtesting.
I recommend investigating replacing os.Hostname fallback with "localhost" fallback in the short term; I can check that that doesn't cause issues with our Linux workstations tomorrow.
from rules_webtesting.
Yep, that works!
from rules_webtesting.
Thank you!
from rules_webtesting.
So, here's something cool. I tried this on a different machine on my network, and the code fails. I made a ticket against the Go repository but I'm not actually sure the Go resolver is behaving incorrectly.
Here's that ticket: golang/go#20904
Does just using localhost
work for y'all or is this hostname lookup still needed?
from rules_webtesting.
Using localhost works for us in every environment we currently have (which are all Linux); for most of the history of this code in Google, we just used localhost for these addresses. We used fqdn code in test procedures for referring to the web server, though, as the browser in our VMs needed to reach it. The fqdn logic was added later when needed for another feature.
(We have a disused mac mini that we could probably experiment on...)
Thanks for filing the ticket.
I would assume the Java fqdn method works correctly on your machines?
http://docs.oracle.com/javase/8/docs/api/java/net/InetAddress.html#getCanonicalHostName--
I'm not opposed to an environment variable that forces localhost in the meantime if that unblocks you.
from rules_webtesting.
Hm, wasn't sure what you address or hostname for me to use to create the InetAddress. I went with a few different ones and found one that was different. Lmk if you had something else in mind.
import java.net.InetAddress;
public class Foo {
public static void main(String[] args) throws Exception {
InetAddress addr = InetAddress.getByAddress(new byte[]{127,0,0,1});
System.out.println(addr.getCanonicalHostName());
addr = InetAddress.getByName("localhost");
System.out.println(addr.getCanonicalHostName());
addr = InetAddress.getLocalHost();
System.out.println(addr.getCanonicalHostName());
}
}
outputs
localhost
localhost
homeportal
from rules_webtesting.
Oh! You meant InetAddress.getByName("iMac")
, of course.
That prints out homeportal
, too.
from rules_webtesting.
Sorry, forgot that wasn't a static method... Meant InetAddress.getLocalHost().getCanonicalHostName() which should result in "homeportal" per your experimentation. getCanonicalHostName would ideally return the fqdn of your machine... Looks like Go maintainers are following up.
from rules_webtesting.
Yeah, if it's happening in both places, maybe it's a platform bug.
btw, I made that patch for that env var but I'm not sure how to pass an env var to the go_web_test_suite target. I'd rather avoid having to put --action_env
in my bazelrc and the env var in my bash_profile if I can because it feels a little easy to forget about.
But maybe that's the only option when using an env var?
from rules_webtesting.
You can either:
- rename the environment variable to mean the opposite and make localhost use default in project (SERVE_ON_FQDN or some better name)
- https://github.com/bazelbuild/rules_webtesting/blob/master/web/internal/web_test.sh.template - check for presence of some SERVE_ON_LOCALHOST-like environment variable; if not present, set to a truthy default.
I probably prefer option 2 just b/c we already branch the shell script template internally.
I think it's OK to use localhost by default for this project and let anyone requiring FQDN (no one yet) to opt-in as the logic is currently causing issues for mac - and I don't believe any of the VM stuff or optional features requiring fqdn for remote browsers are open sourced at this point.
from rules_webtesting.
I don't quite follow option 2's description. Would a different env var be set and looked at in the Go code?
from rules_webtesting.
Recently back from vacation... More details...
in the web_test.sh.template, was thinking:
if [[ -z "$SERVE_ON_LOCALHOST" ]]; then
export SERVE_ON_LOCALHOST=true
fi
Then there is go/launcher/cmdhelper which would allow something like:
if cmdhelper.IsTruthyEnv("SERVE_ON_LOCALHOST") {
return "localhost"
}
Also would be fine with always returning "localhost" for Mac platform for now.
Feel free to make whatever change makes this work for you by default - without having to pass any additional options or customize your blazerc (as long as there is some env var way for us to switch it off). Or feel free to request that I just make a change and I can throw something passable together.
from rules_webtesting.
Okay, I've not gotten any closer on this. I don't know why we couldn't use localhost everywhere?
Also, could this be reopened?
from rules_webtesting.
I just ran into this issue. A web_test target I'd written suddenly started timing out with no code changes. @jmhodges, thanks for your excellent documentation here and in golang/go#20904.
In my case, I was able to remove the offending name server from my OS's DNS configuration, and the test passed. But I'm strongly in favor of using localhost
by default wherever possible. DNS configuration is a complex source of nondeterminism. If users of rules_webtesting want that nondeterminism, IMO it should be opt-in rather than opt-out.
@jmhodges is your fork suitable for merging? I'm reasonably good at SkyStarlark and can help out.
from rules_webtesting.
It's not been updated recently, unfortunately. I didn't do anything other than the minimum required to get FQDN
to always return "localhost"
, though.
from rules_webtesting.
Also, you might want to make a new ticket since this one is closed and they don't seem to be commenting on it
from rules_webtesting.
@joshbruning would you mind reopening this issue? I could file a new one, but it would refer to most of the discussion here.
In any case, I'll try to send a PR soon.
from rules_webtesting.
Ping
from rules_webtesting.
Is this still an issue for you?
from rules_webtesting.
Related Issues (20)
- Coverage support? HOT 1
- Usage within Docker - "bind() failed: Cannot assign requested address (99)" HOT 4
- Update chromium version HOT 1
- Document and fix releaser.sh
- `jasmine_web_test_suite()`
- Debuggable browsers out-of-the-box
- Chromium arm64 provided can't be executed due to spaces in its path. HOT 2
- firefox times out in Github Actions HOT 6
- Flag --incompatible_config_setting_private_default_visibility will break rules_webtesting in Bazel 7.0 HOT 7
- Flag --incompatible_disable_starlark_host_transitions will break rules_webtesting in Bazel 7.0 HOT 3
- configurable attribute "out" in @io_bazel_rules_webtesting//go/wtl/main:main doesn't match this configuration
- Version tags after `v0.2.0` are missing the `v` prefix and no longer usable in `go.mod`
- Updating browser versions and doing a release?
- Transient test failues when running web_test_suite HOT 2
- rules_webtesting is failing with Bazel@HEAD in CI HOT 7
- Error no such target '@platforms//os:visionos': target 'visionos' not declared in package 'os' with Bazel@HEAD
- Add support for Bzlmod HOT 1
- Minimal example failing on macOS M1 HOT 1
- Add support for C++ HOT 5
- webtest are failing with Bazel@HEAD
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_webtesting.