mirror of
https://github.com/juanfont/headscale.git
synced 2026-01-11 20:00:28 +01:00
[Bug] TestDERPServerWebsocketScenario is broken #855
Closed
opened 2025-12-29 02:24:53 +01:00 by adam
·
9 comments
No Branch/Tag Specified
main
update_flake_lock_action
gh-pages
kradalby/release-v0.27.2
dependabot/go_modules/golang.org/x/crypto-0.45.0
dependabot/go_modules/github.com/opencontainers/runc-1.3.3
copilot/investigate-headscale-issue-2788
copilot/investigate-visibility-issue-2788
copilot/investigate-issue-2833
copilot/debug-issue-2846
copilot/fix-issue-2847
dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
dependabot/go_modules/github.com/docker/docker-28.3.3incompatible
kradalby/cli-experiement3
doc/0.26.1
doc/0.25.1
doc/0.25.0
doc/0.24.3
doc/0.24.2
doc/0.24.1
doc/0.24.0
kradalby/build-docker-on-pr
topic/docu-versioning
topic/docker-kos
juanfont/fix-crash-node-id
juanfont/better-disclaimer
update-contributors
topic/prettier
revert-1893-add-test-stage-to-docs
add-test-stage-to-docs
remove-node-check-interval
fix-empty-prefix
fix-ephemeral-reusable
bug_report-debuginfo
autogroups
logs-to-stderr
revert-1414-topic/fix_unix_socket
rename-machine-node
port-embedded-derp-tests-v2
port-derp-tests
duplicate-word-linter
update-tailscale-1.36
warn-against-apache
ko-fi-link
more-acl-tests
fix-typo-standalone
parallel-nolint
tparallel-fix
rerouting
ssh-changelog-docs
oidc-cleanup
web-auth-flow-tests
kradalby-gh-runner
fix-proto-lint
remove-funding-links
go-1.19
enable-1.30-in-tests
0.16.x
cosmetic-changes-integration
tmp-fix-integration-docker
fix-integration-docker
configurable-update-interval
show-nodes-online
hs2021
acl-syntax-fixes
ts2021-implementation
fix-spurious-updates
unstable-integration-tests
mandatory-stun
embedded-derp
prtemplate-fix
v0.28.0-beta.1
v0.27.2-rc.1
v0.27.1
v0.27.0
v0.27.0-beta.2
v0.27.0-beta.1
v0.26.1
v0.26.0
v0.26.0-beta.2
v0.26.0-beta.1
v0.25.1
v0.25.0
v0.25.0-beta.2
v0.24.3
v0.25.0-beta.1
v0.24.2
v0.24.1
v0.24.0
v0.24.0-beta.2
v0.24.0-beta.1
v0.23.0
v0.23.0-rc.1
v0.23.0-beta.5
v0.23.0-beta.4
v0.23.0-beta3
v0.23.0-beta2
v0.23.0-beta1
v0.23.0-alpha12
v0.23.0-alpha11
v0.23.0-alpha10
v0.23.0-alpha9
v0.23.0-alpha8
v0.23.0-alpha7
v0.23.0-alpha6
v0.23.0-alpha5
v0.23.0-alpha4
v0.23.0-alpha4-docker-ko-test9
v0.23.0-alpha4-docker-ko-test8
v0.23.0-alpha4-docker-ko-test7
v0.23.0-alpha4-docker-ko-test6
v0.23.0-alpha4-docker-ko-test5
v0.23.0-alpha-docker-release-test-debug2
v0.23.0-alpha-docker-release-test-debug
v0.23.0-alpha4-docker-ko-test4
v0.23.0-alpha4-docker-ko-test3
v0.23.0-alpha4-docker-ko-test2
v0.23.0-alpha4-docker-ko-test
v0.23.0-alpha3
v0.23.0-alpha2
v0.23.0-alpha1
v0.22.3
v0.22.2
v0.23.0-alpha-docker-release-test
v0.22.1
v0.22.0
v0.22.0-alpha3
v0.22.0-alpha2
v0.22.0-alpha1
v0.22.0-nfpmtest
v0.21.0
v0.20.0
v0.19.0
v0.19.0-beta2
v0.19.0-beta1
v0.18.0
v0.18.0-beta4
v0.18.0-beta3
v0.18.0-beta2
v0.18.0-beta1
v0.17.1
v0.17.0
v0.17.0-beta5
v0.17.0-beta4
v0.17.0-beta3
v0.17.0-beta2
v0.17.0-beta1
v0.17.0-alpha4
v0.17.0-alpha3
v0.17.0-alpha2
v0.17.0-alpha1
v0.16.4
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.16.0-beta7
v0.16.0-beta6
v0.16.0-beta5
v0.16.0-beta4
v0.16.0-beta3
v0.16.0-beta2
v0.16.0-beta1
v0.15.0
v0.15.0-beta6
v0.15.0-beta5
v0.15.0-beta4
v0.15.0-beta3
v0.15.0-beta2
v0.15.0-beta1
v0.14.0
v0.14.0-beta2
v0.14.0-beta1
v0.13.0
v0.13.0-beta3
v0.13.0-beta2
v0.13.0-beta1
upstream/v0.12.4
v0.12.4
v0.12.3
v0.12.2
v0.12.2-beta1
v0.12.1
v0.12.0-beta2
v0.12.0-beta1
v0.11.0
v0.10.8
v0.10.7
v0.10.6
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.1
v0.6.0
v0.5.2
v0.5.1
v0.5.0
v0.4.0
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v0.2.0
v0.1.1
v0.1.0
Labels
Clear labels
CLI
DERP
DNS
Nix
OIDC
SSH
bug
database
documentation
duplicate
enhancement
faq
good first issue
grants
help wanted
might-come
needs design doc
needs investigation
no-stale-bot
out of scope
performance
policy 📝
pull-request
question
regression
routes
stale
tags
tailscale-feature-gap
well described ❤️
wontfix
Mirrored from GitHub Pull Request
No Label
bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/headscale#855
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kradalby on GitHub (Nov 17, 2024).
TestDERPServerWebsocketScenario is broken after websockets was removed from all clients but JS one:
020cacbe70From #2046:
@enoperm:
I agree that it is something to in general avoid, I am also not sure if you can run the JS client outside of a browser? Maybe it can be ran with NodeJS in a container? It looks like it can be forced into a Go client with a build flag?
I must admit I am not stoked about having to maintain that kind of container to test this, but maybe it can be done for only this test. I dont really want to remove the feature, but if it is untestable that might be a step to go for if it breaks in the future, it can be left until someone notices, but we are not maintaining features that cant be tested.
I agree, that is good, now we just need to make sure we continue to have tests.
@enoperm commented on GitHub (Nov 17, 2024):
I have not looked into it much yet, but from what I have read so far, it should be possible to build the official client code with a flag to restore websocket support. Clients built with the flag still need to be controlled through the same variable as before - or rather, the referenced commit does not include changes to the functionality itself.
Whether the flag and the behaviour it unlocks is intended for removal in the future, I do not know. If Tailscale ends up not using it as a part of their own test suite, it would make sense for them to consider it dead code.
I think the last time I checked, the full client only ran in the browser, although I have ended up not experimenting much with the full Tailscale client, and instead forked off the
tsconnectcode to use it as a library instead.If my memory serves correctly, it only took small patches to build the client with
GOARCH=wasip1, but it had no means of opening a control socket. I think that's probably the most important blocker for that route.I could try carving out the most relevant parts of one of my pet projects (the one that resulted in the websocket support MR), but running that would also require a browser, so I'd prefer to avoid this direction.
If testing the feature in itself is enough, perhaps I could just whip up a standalone DERP client. I have toyed with one before, although I have not tried to force websocket usage at that time.
@kradalby commented on GitHub (Nov 17, 2024):
It does sound like building a client from HEAD for that particular test with the build flag pulling in websockets is the least custom part, so that would be preferable from a maintenance point of view.
Pass the build flag as an envvar to the HEAD build path in the integration test would make sense to me.
@enoperm commented on GitHub (Nov 17, 2024):
Short term, definitely. It does have the potential to yield another ticket about these tests down the road should Tailscale remove the flag.
@ArcticLampyrid commented on GitHub (Nov 18, 2024):
How about conducting tests on a real WebAssembly client in a browser? This can be done using Selenium or something similar.
Of course, this approach will be resource-intensive.
@enoperm commented on GitHub (Nov 18, 2024):
I'll dig into what can be done with a WASM build in/outside a browser later, but first, I say let's tackle it with a custom build, as @kradalby suggested - that'll fix the testcases for everyone else. I raised my concerns, but I don't want to block a working solution while searching for a better one.
@kradalby commented on GitHub (Nov 18, 2024):
I dont really want to have to maintain browser tests, I will say a custom built client is already towards past what I want to deal with.
@enoperm commented on GitHub (Nov 18, 2024):
I would rather avoid pulling in a browser as well.
I had some time to look at it, and fixing it for
HEAD-version test instances is trivial, since the existing code already builds the current version locally. Other versions of the client are a bit more of a problem, because currently, the corresponding images are pulled from Docker Hub, and from what I can see there are no builds compiled with-tags ts_debug_websockets.So, assuming we do want to go down the route of custom-built clients while keeping the test matrix, we either have to build other versions of Tailscale locally in addition to
HEAD(we can still fallback to Docker Hub for images that predate the build flag to save time), or have to provide prebuilt images with the expected build flags to avoid the extra resource usage and build time on every single test execution.In the latter case, the images need to be built, and stored somewhere (I'd guess preferably in a CI/CD pipeline, somewhere, which means someone would have to set it all up), the clients used in tests may lag behind official releases while someone or something triggers that pipeline (I don't think that's a major issue for this project), and we'd potentially be missing out on updates to older tags if we are not careful about the implementation. I looked through the Tailscale changelog and I have found at least one example of a security update that was released for an older version.
I suspect neither of us wants to put that much effort into supporting a singe test case, for a feature that (since it was never available in released version of the built-in DERP server) currently has no users.
With that in mind, how about restricting that testcase to only running against
HEAD? It'd still be running off the official client code, the feature would still get tested, and considering how rarely their gitHEADoverlaps with an officially released client, the client does not seem any less realistic than it was before.As a plan B, the official
derperbinary is also 100% compatible with websockets, so just removing the test and documenting that for this specific feature users may want to use that is also a possibility.@kradalby commented on GitHub (Nov 19, 2024):
I wont consider that an option, we are testing the embedded stuff, so that needs to be tested.
Let us use only HEAD for this one test then, it is a trade off I am willing to accept for this one test. Ignore other versions.
We need to get something in, lets keep it simple, make it so we can pass it from https://github.com/juanfont/headscale/blob/main/integration/hsic/hsic.go#L262 with a
WithBuildTagoption. We are currently blocking other merges atm.@enoperm commented on GitHub (Nov 19, 2024):
I think I got it to work. The validation around the websocket derp option is perhaps a bit overzealous right now, since it also results in a build tag and I also put a misuse check on those, but better safe than sorry.