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

add deploy action #27

Merged
merged 37 commits into from
Feb 23, 2024
Merged

add deploy action #27

merged 37 commits into from
Feb 23, 2024

Conversation

Kylen0714
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Dec 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.90%. Comparing base (6358816) to head (d5e29d2).

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #27   +/-   ##
=========================================
  Coverage     30.90%   30.90%           
  Complexity      766      766           
=========================================
  Files           176      176           
  Lines          7345     7345           
  Branches        577      577           
=========================================
  Hits           2270     2270           
  Misses         4902     4902           
  Partials        173      173           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


- name: Run API Test
run: |
set response $(curl --location 'http://localhost:8080/flow/bg/manage/descriptor/add_descriptor.json?business_id=rillFlowSample&feature_name=choiceSample&alias=release' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该用测试框架执行测试。

- name: Set up Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupjdk里包含maven

run: mvn clean package -am && echo "Maven Build and package succeeded" || { echo "Maven Build and package failed."; exit 1; }

- name: Run Internal Test
run: mvn test && echo "Maven Run Internal Test succeeded"|| { echo "Run Internal Test failed."; exit 1; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package包含test

@@ -33,13 +33,13 @@ jobs:
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B clean javadoc:javadoc clean verify -P coverage -DskipITs=false -Dmaven.test.skip=false
run: mvn -B clean javadoc:javadoc clean verify -P coverage -DskipITs=false -Dmaven.test.skip=false -pl '!rill-flow-test'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该默认不运行rill-flow-test,而不是显式指定不运行

import static org.junit.jupiter.api.Assertions.assertEquals

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该使用spock的Stepwise来顺序执行测试


@Test
@Order(1)
public void testChoiceSampleAddDescriptor() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没有使用spock的基本测试格式

// 执行 API 请求并获取响应
ApiResponse response = sendApiRequest(url, contentType, requestData);
// 使用测试断言来验证测试结果
assertEquals(200, response.getStatusCode(), response.getResponseContent());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没有使用spock风格的assert

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class SampleApiTest extends Specification {
class ApiResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接用map,不需要单独定义类

int statusCode = response.getStatusLine().getStatusCode();
String responseContent = EntityUtils.toString(entity);

return new ApiResponse(statusCode, responseContent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接用jsonslurper解析

private String readFileContent(String filePath) {
try {
// 读取文件内容并返回
return new String(Files.readAllBytes(Paths.get(filePath)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return new File('/path/to/file').text

String contentType = "application/json";
String requestData = "{\"input_num\":10}";
ApiResponse response = sendApiRequest(url, contentType, requestData);
assertEquals(200, response.getStatusCode(), response.getResponseContent());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只验证了状态码,没有验证返回内容和图的业务结果

@qdaxb qdaxb merged commit 0007151 into weibocom:main Feb 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants