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

Conversation

j-sandy
Copy link
Contributor

@j-sandy j-sandy commented Jul 15, 2024

Startup test under module keiko-mem-spring and keiko-redis-spring are not executing and throwing below error:

> Task :keiko-mem-spring:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keiko-mem-spring:test'.
> No tests found for given includes: [com.netflix.spinnaker.q.mem.spring.SpringStartupTests](--tests filter)

> Task :keiko-redis-spring:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keiko-redis-spring:test'.
> No tests found for given includes: [com.netflix.spinnaker.q.redis.spring.SpringStartupTests](--tests filter)

After fixing these issues by refactoring the junit platform as junit-jupiter, encountered below errors while execution:

Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.netflix.spectator.api.Registry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at app//org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
	at app//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
	... 133 more
Failed to load ApplicationContext
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.spinnaker.q.redis.RedisQueue]: Factory method 'queue' threw exception; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at app//org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
	... 120 more

To fix these errors refactored the test by adding Registry and JedisPool beans.

… tests

Startup test under module keiko-mem-spring and keiko-redis-spring are not executing and throwing below error:

```
> Task :keiko-mem-spring:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keiko-mem-spring:test'.
> No tests found for given includes: [com.netflix.spinnaker.q.mem.spring.SpringStartupTests](--tests filter)

```

```
> Task :keiko-redis-spring:test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':keiko-redis-spring:test'.
> No tests found for given includes: [com.netflix.spinnaker.q.redis.spring.SpringStartupTests](--tests filter)

```
After fixing these issues by refactoring the junit platform as `junit-jupiter`, encountered below errors while execution:
```
Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.netflix.spectator.api.Registry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1801)
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1357)
	at app//org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at app//org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:911)
	at app//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
	... 133 more
```

```
Failed to load ApplicationContext
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.spinnaker.q.redis.RedisQueue]: Factory method 'queue' threw exception; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
	at app//org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at app//org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
	... 120 more
```
To fix these errors refactored the test by adding `Registry` and `JedisPool` beans.
@j-sandy j-sandy force-pushed the fix-startup-test branch from 9576cef to d24093f Compare July 15, 2024 16:22
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Jul 15, 2024
@mergify mergify bot added the auto merged Merged automatically by a bot label Jul 15, 2024
@mergify mergify bot merged commit 4e1c41b into spinnaker:master Jul 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.35
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants