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

fix(tests): refactor tests and junit platform name to execute startup tests #4764

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions keiko-mem-spring/keiko-mem-spring.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ dependencies {

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

test {
useJUnitPlatform {
includeEngines "jupiter"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.netflix.spinnaker.q.mem.spring

import com.netflix.spectator.api.NoopRegistry
import com.netflix.spinnaker.config.MemQueueConfiguration
import com.netflix.spinnaker.config.QueueConfiguration
import com.netflix.spinnaker.q.DeadMessageCallback
Expand All @@ -13,6 +14,7 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.test.context.junit.jupiter.SpringExtension
import com.netflix.spectator.api.Registry

@ExtendWith(SpringExtension::class)
@SpringBootTest(
Expand All @@ -34,4 +36,7 @@ internal class SpringStartupTests {
internal class TestConfiguration {
@Bean
fun deadMessageCallback(): DeadMessageCallback = { _, _ -> }

@Bean
fun registry(): Registry = NoopRegistry()
}
7 changes: 1 addition & 6 deletions keiko-redis-spring/keiko-redis-spring.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ dependencies {
testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.assertj:assertj-core"
testImplementation("io.spinnaker.kork:kork-jedis-test")

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

test {
useJUnitPlatform {
includeEngines "jupiter"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.netflix.spinnaker.q.redis.spring

import com.netflix.spectator.api.NoopRegistry
import com.netflix.spectator.api.Registry
import com.netflix.spinnaker.config.QueueConfiguration
import com.netflix.spinnaker.config.RedisQueueConfiguration
import com.netflix.spinnaker.q.Queue
Expand All @@ -10,11 +12,15 @@ import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.test.context.junit.jupiter.SpringExtension
import com.netflix.spinnaker.kork.jedis.EmbeddedRedis
import redis.clients.jedis.JedisPool

@ExtendWith(SpringExtension::class)
@SpringBootTest(
classes = [QueueConfiguration::class, RedisQueueConfiguration::class],
classes = [QueueConfiguration::class, RedisQueueConfiguration::class, TestConfiguration::class],
webEnvironment = NONE
)
internal class SpringStartupTests {
Expand All @@ -27,3 +33,11 @@ internal class SpringStartupTests {
Assertions.assertThat(queue).isNotNull.isInstanceOf(RedisQueue::class.java)
}
}
@Configuration
internal class TestConfiguration {
@Bean
fun registry(): Registry = NoopRegistry()

@Bean
fun queueRedisPool(): JedisPool = EmbeddedRedis.embed().pool
}