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

Disable usage of port 63342 to avoid 301 errors in IntelliJ #808

Open
scprek opened this issue Jan 6, 2025 · 2 comments
Open

Disable usage of port 63342 to avoid 301 errors in IntelliJ #808

scprek opened this issue Jan 6, 2025 · 2 comments

Comments

@scprek
Copy link
Contributor

scprek commented Jan 6, 2025

Expected Behavior

Start up micronaut test resources without any issue when running ./gradlew test

Actual Behaviour

Unexpected response code: 301 <!doctype html><title>301 Moved Permanently</title><h1 style="text-align: center">301 Moved Permanently</h1>
io.micronaut.testresources.client.TestResourcesException: Unexpected response code: 301 <!doctype html><title>301 Moved Permanently</title><h1 style="text-align: center">301 Moved Permanently</h1>
	at io.micronaut.testresources.client.DefaultTestResourcesClient.request(DefaultTestResourcesClient.java:153)
	at io.micronaut.testresources.client.DefaultTestResourcesClient.getResolvableProperties(DefaultTestResourcesClient.java:82)
	at io.micronaut.testresources.client.TestResourcesClientPropertySourceLoader$ClientTestResourcesResolver.lambda$produceKeys$0(TestResourcesClientPropertySourceLoader.java:57)
	at java.base/java.util.Optional.map(Optional.java:260)
	at io.micronaut.testresources.client.TestResourcesClientPropertySourceLoader$ClientTestResourcesResolver.produceKeys(TestResourcesClientPropertySourceLoader.java:57)
	at io.micronaut.testresources.core.LazyTestResourcesPropertySourceLoader$LazyPropertySource.computeKeys(LazyTestResourcesPropertySourceLoader.java:109)
	at io.micronaut.testresources.core.LazyTestResourcesPropertySourceLoader$LazyPropertySource.iterator(LazyTestResourcesPropertySourceLoader.java:90)
	at io.micronaut.context.env.PropertySourcePropertyResolver.processPropertySource(PropertySourcePropertyResolver.java:594)
	at io.micronaut.context.env.DefaultEnvironment.readPropertySources(DefaultEnvironment.java:459)
	at io.micronaut.context.env.DefaultEnvironment.start(DefaultEnvironment.java:277)
	at io.micronaut.context.DefaultApplicationContext$RuntimeConfiguredEnvironment.start(DefaultApplicationContext.java:963)
	at io.micronaut.context.DefaultApplicationContext$RuntimeConfiguredEnvironment.start(DefaultApplicationContext.java:932)
	at io.micronaut.context.DefaultApplicationContext.startEnvironment(DefaultApplicationContext.java:286)
	at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:215)
	at io.micronaut.test.extensions.AbstractMicronautExtension.startApplicationContext(AbstractMicronautExtension.java:507)
	at io.micronaut.test.extensions.AbstractMicronautExtension.beforeClass(AbstractMicronautExtension.java:346)
	at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeAll(MicronautJunit5Extension.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

When I ran stopTestResourcesService I got a NOT_FOUND error on localhost:63342

I wondered if something odd happened with the build_in_server of the IDE?
https://www.jetbrains.com/help/idea/settings-debugger.html#debugger_built_in_server

Steps To Reproduce

I'm not entirely sure....

I ran lsof and saw this

 ❯ lsof | grep :63342 
 idea 7192 stevecprek 33u IPv6 0xbca92e8587ea99e9 0t0 TCP localhost:63342 (LISTEN) 
 idea 7192 stevecprek 770u IPv6 0xa2a1e9ca1e052ec7 0t0 TCP localhost:63342->localhost:50893 (ESTABLISHED)
  java 7667 stevecprek 376u IPv6 0x3e8171fa8445bfe2 0t0 TCP localhost:50893->localhost:63342 (ESTABLISHED)

The way I fixed it, is I start/stop and ran my tests in a terminal without IntelliJ running. It must have changed my test-resources.properties file (wish I checked before)

I tried to manually set the port again and could not reproduce after fixing and could not 🤷🏼

❯ cat ~/.micronaut/test-resources/test-resources.properties
server.uri=http\://localhost\:63342

Environment Information

  • JDK 17
  • Kotlin 1.9.25

Example Application

No response

Version

4.7.3

@melix
Copy link
Collaborator

melix commented Jan 7, 2025

That's an unfortunate collision... I think however this would have to be moved to micronaut-core, since the test resources service uses the built-in random port selector. I'm actually surprised that it picked up a busy port 🤔

@scprek
Copy link
Contributor Author

scprek commented Jan 7, 2025

Yeah I'm guessing it was some sort of edge case. I've never hit this before ha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants