Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example from WebSockets guide contains an error #20143

Closed
fedinskiy opened this issue Sep 14, 2021 · 0 comments · Fixed by #20482
Closed

Code example from WebSockets guide contains an error #20143

fedinskiy opened this issue Sep 14, 2021 · 0 comments · Fixed by #20482
Labels
kind/bug Something isn't working
Milestone

Comments

@fedinskiy
Copy link
Contributor

Describe the bug

If code from examples on https://quarkus.io/guides/websockets is copied to a real project, then tests will fail with an exception.

Expected behavior

Examples should contain a working code

Actual behavior

Tests from examples will fail with an exception:
SupersonicChatSocketTest.testWebsocketChat:33 expected: <>> stu: hello world> but was: <>> stu: _ready_>

How to Reproduce?

Follow the guideon https://quarkus.io/guides/websockets. In particular:

  1. Create a project:
    mvn io.quarkus.platform:quarkus-maven-plugin:2.2.2.Final:create -DprojectGroupId=org.acme -DprojectArtifactId=websockets-quickstart -Dextensions="websockets" -DnoExamples
  2. Replace content of file SupersonicChatSocket,java with code of ChatSocket class from the guide(https://quarkus.io/guides/websockets#handling-web-sockets)
  3. Run tests: mvn clean verify
  4. Tests fai

Output of uname -a or ver

Linux 5.13.12-200.fc34.x86_64

Output of java -version

11.0.12

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3

Additional information

It looks like the problem happens due to these:

  1. Test class sends message "ready" when it opens connection
  2. Application class(from the guide) resends this message
  3. Tests class doesn't expect the message

Code of application class from quickstarts is a bit different, and replaces "ready" message with standard "User X joined" message. That's why the same test works for an application from quickstarts and fails for an application from the guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant