Skip to content

Commit 357de3b

Browse files
committed
[test] 验证github action失败原因
1 parent a2e727a commit 357de3b

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

framework/fel/java/services/tool-service/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,15 @@
9999
<groupId>org.assertj</groupId>
100100
<artifactId>assertj-core</artifactId>
101101
</dependency>
102+
<dependency>
103+
<groupId>org.slf4j</groupId>
104+
<artifactId>slf4j-api</artifactId>
105+
<version>2.0.16</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.apache.logging.log4j</groupId>
109+
<artifactId>log4j-core</artifactId>
110+
<version>2.24.3</version>
111+
</dependency>
102112
</dependencies>
103113
</project>

framework/fel/java/services/tool-service/src/test/java/modelengine/fel/tool/support/HttpToolTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import org.junit.jupiter.api.BeforeAll;
3232
import org.junit.jupiter.api.DisplayName;
3333
import org.junit.jupiter.api.Test;
34+
import org.slf4j.Logger;
35+
import org.slf4j.LoggerFactory;
3436

3537
import java.io.IOException;
3638
import java.io.InputStream;
@@ -49,6 +51,8 @@
4951
* @since 2024-06-12
5052
*/
5153
public class HttpToolTest {
54+
private static final Logger log = LoggerFactory.getLogger(HttpToolTest.class);
55+
5256
private static final String TOOL_PATH = "tool/";
5357
private static Integer port = null;
5458
private static final String DEFINITION_GROUP_NAME = "test_definition_group_name";
@@ -66,11 +70,13 @@ static void setupAll() {
6670
if (port == null) {
6771
port = getLocalAvailablePort();
6872
}
73+
log.warn("!!!test in github action!!! setup all: port: {}", port);
6974
TestFitRuntime.INSTANCE.start(port);
7075
}
7176

7277
@AfterAll
7378
static void teardownAll() {
79+
log.warn("!!!test in github action!!! teardown all");
7480
TestFitRuntime.INSTANCE.stop();
7581
}
7682

@@ -132,11 +138,13 @@ void shouldReturnMap() {
132138

133139
Address address = Address.create("jiangsu", "suzhou", 3205);
134140
Education education = Education.create("QUST", "UCAS");
141+
log.warn("!!!test in github action!!! test shouldReturnMap, before execute tool");
135142
Map<String, Object> result = cast(tool.execute("Alice",
136143
26,
137144
address,
138145
education,
139146
Stream.of("0123-4567-8888", "0123-4567-9999").collect(Collectors.toList())));
147+
log.warn("!!!test in github action!!! test shouldReturnMap, after execute tool");
140148
Map<String, Object> addressResult = cast(result.get("address"));
141149
Map<String, Object> educationResult = cast(result.get("education"));
142150
List<String> phoneNumbers = cast(result.get("phoneNumbers"));
@@ -156,7 +164,9 @@ void shouldReturnString() {
156164
Tool.Info info = readToolInfo("string.json");
157165
Tool tool = createTool(info);
158166

167+
log.warn("!!!test in github action!!! test shouldReturnString, before execute tool");
159168
String result = cast(tool.execute(Stream.of("abc", "def", "ghi").collect(Collectors.toList())));
169+
log.warn("!!!test in github action!!! test shouldReturnString, after execute tool");
160170
assertThat(result).isEqualTo("abc,def,ghi");
161171
}
162172

@@ -166,7 +176,9 @@ void shouldReturnInteger() {
166176
Tool.Info info = readToolInfo("integer.json");
167177
Tool tool = createTool(info);
168178

179+
log.warn("!!!test in github action!!! test shouldReturnInteger, before execute tool");
169180
Integer result = cast(tool.execute(Stream.of(1, 2, 3).collect(Collectors.toList())));
181+
log.warn("!!!test in github action!!! test shouldReturnInteger, after execute tool");
170182
assertThat(result).isEqualTo(6);
171183
}
172184

@@ -176,7 +188,9 @@ void shouldReturnNull() {
176188
Tool.Info info = readToolInfo("void.json");
177189
Tool tool = createTool(info);
178190

191+
log.warn("!!!test in github action!!! test shouldReturnNull, before execute tool");
179192
Object result = tool.execute();
193+
log.warn("!!!test in github action!!! test shouldReturnNull, after execute tool");
180194
assertThat(result).isEqualTo(null);
181195
}
182196

@@ -186,7 +200,9 @@ void BasicShouldReturnOk() {
186200
Tool.Info info = readToolInfo("basic-auth.json");
187201
Tool tool = createTool(info);
188202

203+
log.warn("!!!test in github action!!! test BasicShouldReturnOk, before execute tool");
189204
boolean result = cast(tool.execute("{\"name\":\"testuser\", \"pwd\":\"testpass\"}"));
205+
log.warn("!!!test in github action!!! test BasicShouldReturnOk, after execute tool");
190206
assertThat(result).isEqualTo(true);
191207
}
192208

@@ -196,7 +212,9 @@ void ApiKeyShouldReturnOk() {
196212
Tool.Info info = readToolInfo("api-key-auth.json");
197213
Tool tool = createTool(info);
198214

215+
log.warn("!!!test in github action!!! test ApiKeyShouldReturnOk, before execute tool");
199216
boolean result = cast(tool.execute("{\"name\":\"ApiKey\", \"pwd\":\"ApiKeyValue\"}"));
217+
log.warn("!!!test in github action!!! test ApiKeyShouldReturnOk, after execute tool");
200218
assertThat(result).isEqualTo(true);
201219
}
202220

@@ -206,7 +224,9 @@ void ApiKeyQueryShouldReturnOk() {
206224
Tool.Info info = readToolInfo("api-key-query-auth.json");
207225
Tool tool = createTool(info);
208226

227+
log.warn("!!!test in github action!!! test ApiKeyQueryShouldReturnOk, before execute tool");
209228
boolean result = cast(tool.execute("{\"name\":\"ApiKey\", \"pwd\":\"ApiKeyValue\"}"));
229+
log.warn("!!!test in github action!!! test ApiKeyQueryShouldReturnOk, after execute tool");
210230
assertThat(result).isEqualTo(true);
211231
}
212232

@@ -216,7 +236,9 @@ void BearerShouldReturnOk() {
216236
Tool.Info info = readToolInfo("bearer-auth.json");
217237
Tool tool = createTool(info);
218238

239+
log.warn("!!!test in github action!!! test BearerShouldReturnOk, before execute tool");
219240
boolean result = cast(tool.execute("{\"name\":\"test666666666\", \"pwd\":\"invalid\"}"));
241+
log.warn("!!!test in github action!!! test BearerShouldReturnOk, after execute tool");
220242
assertThat(result).isEqualTo(true);
221243
}
222244
}

0 commit comments

Comments
 (0)