Skip to content

Commit 75042b8

Browse files
authored
Added ApplicationContextTest (#12)
* Added ApplicationContextTest * Fixed test name
1 parent 6c07061 commit 75042b8

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@
160160
<version>${testcontainers.annotations.version}</version>
161161
<scope>test</scope>
162162
</dependency>
163+
<dependency>
164+
<groupId>com.h2database</groupId>
165+
<artifactId>h2</artifactId>
166+
<scope>test</scope>
167+
</dependency>
163168
</dependencies>
164169

165170
<build>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package dev.vality.alerting.tg.bot;
2+
3+
import dev.vality.alerting.tg.bot.config.PostgresqlSpringBootITest;
4+
import dev.vality.alerting.tg.bot.dao.ProviderTerminalThreadDao;
5+
import org.junit.jupiter.api.Test;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.context.ApplicationContext;
8+
import org.springframework.test.context.ActiveProfiles;
9+
10+
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
11+
12+
@PostgresqlSpringBootITest
13+
@ActiveProfiles("test")
14+
public class ApplicationContextTest {
15+
16+
@Autowired
17+
private ApplicationContext applicationContext;
18+
19+
@Test
20+
void startApplicationContextTest() {
21+
assertThat(applicationContext).isNotNull();
22+
23+
assertThat(applicationContext.getBean(ProviderTerminalThreadDao.class)).isNotNull();
24+
}
25+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
server:
2+
port: 0
3+
management:
4+
server:
5+
port: 0
6+
metrics:
7+
tags:
8+
application: alerting-tg-bot-test
9+
export:
10+
prometheus:
11+
enabled: true
12+
endpoint:
13+
health:
14+
show-details: always
15+
metrics:
16+
enabled: true
17+
prometheus:
18+
enabled: true
19+
endpoints:
20+
web:
21+
exposure:
22+
include: health,info,prometheus
23+
24+
spring:
25+
application:
26+
name: alerting-tg-bot-test
27+
output:
28+
ansi:
29+
enabled: always
30+
main:
31+
allow-bean-definition-overriding: true
32+
cloud:
33+
vault:
34+
enabled: false
35+
kv:
36+
enabled: false
37+
flyway:
38+
enabled: true
39+
create-schemas: true
40+
schemas: alert_tg_bot
41+
jooq:
42+
sql-dialect: POSTGRES
43+
44+
spring.autoconfigure.exclude: org.telegram.telegrambots.longpolling.starter.TelegramBotStarterConfiguration
45+
46+
info:
47+
version: test
48+
stage: test
49+
50+
bot:
51+
token: TEST_TOKEN_123456:AAAAAA
52+
name: vality_alerting_bot
53+
chatId: -11111111
54+
threads:
55+
commands: 1
56+
errors5xx: 2
57+
altpay-conversion: 3
58+
failed-machines: 4
59+
pending-payments: 5
60+
61+
alertmanager:
62+
webhook:
63+
url: http://localhost:8082/alertmanager/webhook

0 commit comments

Comments
 (0)