Skip to content

Commit

Permalink
chore(dependencies): Autobump korkVersion (#1804)
Browse files Browse the repository at this point in the history
* chore(dependencies): Autobump korkVersion

* chore(dependency): pin graphql-java to avoid version bump during upgrade to spring boot 2.7.x

In spring boot 2.7.x, support for spring-graphql project has been introduced with a new starter `spring-boot-starter-graphql`.

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#new-spring-graphql-starter

Spring boot 2.7.x bring `com.graphql-java:graphql-java:18.5` as its transitive dependency.

https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/2.7.18/spring-boot-dependencies-2.7.18.pom

Since the existing `com.graphql-java-kickstart:graphql-spring-boot-starter:7.0.1` and `com.graphql-java-kickstart:graphql-java-tools:6.0.2` uses graphql-java:14.0, pinning the graphql-java version to 14.0 till the adoption of new spring-graphql-starter.

* refactor(test): add EmbeddedRedis to get connection pool for test execution during upgrade to spring boot 2.7.x

While upgrading spring boot 2.7.18, encounter below error during test compilation of gate-web module:
```
Unexpected exception thrown: java.lang.AssertionError:
Expecting:
 <Unstarted application context org.springframework.boot.test.context.assertj.AssertableApplicationContext[startupFailure=org.springframework.context.ApplicationContextException]>
to get beans of type:
 <org.springframework.session.data.redis.config.ConfigureRedisAction>:
but context failed to start:
 org.springframework.context.ApplicationContextException: Failed to start bean 'springSessionRedisMessageListenerContainer'; nested exception is org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
```
The `com.netflix.spinnaker.gate.config.RedisConfigTest.testCircularDependenciesException` and `com.netflix.spinnaker.gate.config.RedisConfigTest.testCircularDependenciesExceptionSecure` tests generated the above error. The root cause is unavailability of redis resource pool. So, adding EmbeddedRedis to provide resource pool during test execution.

---------

Co-authored-by: root <root@51dce6428a99>
Co-authored-by: j-sandy <30489233+j-sandy@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 12, 2024
1 parent 7ec6d3e commit f13362c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions gate-web/gate-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ dependencies {

implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:7.0.1"
implementation "com.graphql-java-kickstart:graphql-java-tools:6.0.2"
implementation ("com.graphql-java:graphql-java:14.0") { // To avoid version bump with spring boot 2.7.x upgrade.
force = true // Unpin it after adoption of spring-boot-starter-graphql
}

implementation "io.springfox:springfox-swagger2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import com.netflix.spinnaker.kork.jedis.EmbeddedRedis;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.session.data.redis.config.ConfigureRedisAction;

class RedisConfigTest {

EmbeddedRedis redis = embeddedRedis();
String conn = "redis.connection=redis://" + redis.getHost() + ":" + redis.getPort();

@Test
public void testCircularDependenciesException() {
ApplicationContextRunner applicationContextRunner =
new ApplicationContextRunner()
.withPropertyValues(conn)
.withUserConfiguration(RedisConfig.class, RedisActionConfig.class)
.withBean(PostConnectionConfiguringJedisConnectionFactory.class);
assertDoesNotThrow(
Expand All @@ -43,11 +48,19 @@ public void testCircularDependenciesExceptionSecure() {
new ApplicationContextRunner()
.withUserConfiguration(RedisConfig.class, RedisActionConfig.class)
.withBean(PostConnectionConfiguringJedisConnectionFactory.class)
.withPropertyValues("redis.configuration.secure", "true");
.withPropertyValues("redis.configuration.secure", "true")
.withPropertyValues(conn);

assertDoesNotThrow(
() ->
applicationContextRunner.run(
ctx -> assertThat(ctx).getBeans(ConfigureRedisAction.class).hasSize(2)));
}

EmbeddedRedis embeddedRedis() {
EmbeddedRedis redis = EmbeddedRedis.embed();
redis.getJedis().connect();
redis.getJedis().ping();
return redis;
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
enablePublishing=false
fiatVersion=1.47.0
includeProviders=basic,iap,ldap,oauth2,saml,x509
korkVersion=7.229.0
korkVersion=7.230.0
kotlinVersion=1.6.21
org.gradle.parallel=true
spinnakerGradleVersion=8.32.1
Expand Down

0 comments on commit f13362c

Please sign in to comment.