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

[Feat] extend assertion timeout for e2e local #103

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3fc6709
ADM-840:[backend]fix: fix bug for generate error info when generate r…
yulongcai Mar 4, 2024
09dfc27
ADM-817: [frontend] fix: don't show step or branch when no pipeline m…
mrcuriosity-tw Mar 4, 2024
9e6fa30
Fix the bug about github pr filtering when forked repo merge back to …
davidwangcn9 Mar 4, 2024
a138df4
ADM-831:[frontend]feat: add pipeline is future time check (#1110)
weiraneve Mar 5, 2024
92a6df0
ADM-841: [frontend] fix: show board configuration config in metrics s…
neomgb Mar 5, 2024
213b20a
ADM-831:[frontend]feat: add pipeline is future time check (#1112)
weiraneve Mar 5, 2024
3d96f44
[frontend]ADM-767: make disable for pipeline name (#1113)
lxuebing Mar 5, 2024
ae21e45
ADM-767 [frontend] test: fix e2e test (#1115)
lxuebing Mar 5, 2024
5209bb3
ADM-818: [frontend] fix hide loading button when pipeline info ge… (#…
Mar 5, 2024
51517df
ADM-841: [frontend] fix: fix next button display logic (#1116)
neomgb Mar 5, 2024
9a438d8
ADM-818:[Frontend] fix pipeline
SimonTal Mar 5, 2024
1a4e208
fix(sonar): fix sonar issues (#1117)[backend]
guzhongren Mar 5, 2024
85d570c
pref(gradle): skip success console log for testing
guzhongren Mar 5, 2024
f24cb86
pref(gradle): update the swagger host
guzhongren Mar 5, 2024
12e6db9
pref(swagger): put swagger host in the env[backend]
guzhongren Mar 5, 2024
8734adf
[frontend] ADM-767: sort the disabled options (#1119)
lxuebing Mar 6, 2024
0f6f7fa
fix: put swagger host in the env[backend] (#1120)
lxuebing Mar 6, 2024
7f2fc60
Adm-839[frontend]fix change time then board & pipeline configuration …
pfpatrick Mar 6, 2024
b0260db
ADM-789:[Docs] update E2E docs (#1123)
SimonTal Mar 6, 2024
7fd180c
Sonar ignore (#1124)[backend]
guzhongren Mar 6, 2024
40b4f5a
Sonar ignore 1 (#1125)
guzhongren Mar 6, 2024
fe9e5aa
pref(sonar): update UT coverage (#1126)
guzhongren Mar 6, 2024
8531108
ADM-826 [frontend] style: enhance style for report detail (#1118)
lxuebing Mar 7, 2024
a3d81bc
ADM-839[frontend]refactor dispatch update config & add UT (#1127)
pfpatrick Mar 7, 2024
e26e53a
ADM-839[frontend]fix reload pipeline config (#1128)
pfpatrick Mar 7, 2024
5b49c00
ADM-831:[frontend]feat: add future time check for metrics step (#1121)
weiraneve Mar 7, 2024
83c529d
ADM-831:[frontend]refactor: update pipeline no step logic (#1129)
weiraneve Mar 8, 2024
8e065c2
ADM-839[frontend]fix reload pipeline config when reset source control…
pfpatrick Mar 8, 2024
d55d90c
pref(snapshot): remove snapshot, because the snapshot is hard to upda…
guzhongren Mar 9, 2024
ad9c533
fix(security): update cloudformation to fix security issues
guzhongren Mar 9, 2024
0863b3c
Update issue template
davidwangcn9 Mar 10, 2024
b398b9c
Update issue template with refined wording
davidwangcn9 Mar 10, 2024
864db42
ADM-839[frontend]fix next button when no jira card (#1131)
pfpatrick Mar 11, 2024
4f93e87
chore: extend the timeout of e2e local assertion because of the poor …
mrcuriosity-tw Mar 11, 2024
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
53 changes: 49 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ body:
- type: markdown
attributes:
value: |
## Request Detail

The issue list is reserved exclusively for bug reports and feature requests.

For usage questions, please use the following resources:
Expand Down Expand Up @@ -54,8 +56,51 @@ body:
description: What tools will support your request feature?
multiple: true
options:
- Board
- Pipeline Tool
- Source Control
- Board (like Jira)
- Pipeline Tool (like buildkite)
- Source Control (like github)
validations:
required: true

- type: markdown
attributes:
value: |
## Account Detail

Let's know more about you and your account. We will horizontally evaluate all received requests to adjust the priority.

**Below information are important in terms of prioritization.**

- type: input
id: account_info
attributes:
label: Account name
description: What's your account name?
placeholder: Make sure it could be found in jigsaw
validations:
required: true

- type: input
id: account_location
attributes:
label: Account location
description: Which country you account locate at?
validations:
required: true

- type: input
id: account_size
attributes:
label: Teams in Account
description: How many teams will adopt heartbeat after feature release?
validations:
required: true

- type: input
id: expected_date
attributes:
label: Expected launch date
description: What is the latest possible launch date you can accept?
placeholder: 2024-12
validations:
required: true
required: false
33 changes: 32 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
events "skipped", "failed"
}
finalizedBy jacocoTestReport
}
Expand All @@ -72,6 +72,7 @@ sonar {
property "sonar.projectKey", "au-heartbeat-heartbeat-backend"
property "sonar.organization", "au-heartbeat"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.exclusions", "src/main/java/heartbeat/HeartbeatApplication.java,src/main/java/heartbeat/config/**,src/main/java/heartbeat/util/SystemUtil.java"
}
}

Expand Down Expand Up @@ -100,6 +101,36 @@ jacocoTestCoverageVerification {
violationRules {
rule {
limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 1.0
}
}
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 1.0
}
}
rule {
limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 1.0
}
}
rule {
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.90
}
}
rule {
limit {
counter = 'CLASS'
value = 'COVEREDRATIO'
minimum = 1.0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class PullRequestInfo implements Serializable {

private Integer number;

private String url;

@JsonProperty("created_at")
private String createdAt;

Expand Down
7 changes: 6 additions & 1 deletion backend/src/main/java/heartbeat/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -12,11 +14,14 @@
@Configuration
public class SwaggerConfig {

@Value("${heartbeat.swagger.host}")
private String swaggerHost;

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI().components(new Components())
.info(new Info().title("Backend API").version("1.0"))
.servers(List.of(new Server().url("http://13.214.14.43:4321/api/v1")));
.servers(List.of(new Server().url(String.format("%s/api/v1", this.swaggerHost))));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
public class AsyncExceptionHandler extends AsyncDataBaseHandler {

public void put(String reportId, BaseException e) {
createFileByType(ERROR, reportId, new Gson().toJson(e));
createFileByType(ERROR, reportId, new Gson().toJson(new AsyncExceptionDTO(e)));
}

public BaseException get(String reportId) {
public AsyncExceptionDTO get(String reportId) {
return readFileByType(ERROR, reportId, AsyncExceptionDTO.class);
}

public BaseException remove(String reportId) {
public AsyncExceptionDTO remove(String reportId) {
return readAndRemoveFileByType(ERROR, reportId, AsyncExceptionDTO.class);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package heartbeat.handler.base;

import heartbeat.exception.BaseException;
import lombok.AllArgsConstructor;
import lombok.Data;

public class AsyncExceptionDTO extends BaseException {
@Data
@AllArgsConstructor
public class AsyncExceptionDTO {

public AsyncExceptionDTO(String message, int status) {
super(message, status);
private String message;

private int status;

public AsyncExceptionDTO(BaseException e) {
this.message = e.getMessage();
this.status = e.getStatus();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package heartbeat.service.report;

import heartbeat.client.dto.codebase.github.PipelineLeadTime;
import heartbeat.controller.report.dto.request.GenerateReportRequest;
import heartbeat.controller.report.dto.request.JiraBoardSetting;
import heartbeat.controller.report.dto.response.ErrorInfo;
Expand All @@ -15,6 +14,7 @@
import heartbeat.handler.AsyncExceptionHandler;
import heartbeat.handler.AsyncMetricsDataHandler;
import heartbeat.handler.AsyncReportRequestHandler;
import heartbeat.handler.base.AsyncExceptionDTO;
import heartbeat.service.report.calculator.ChangeFailureRateCalculator;
import heartbeat.service.report.calculator.ClassificationCalculator;
import heartbeat.service.report.calculator.CycleTimeCalculator;
Expand Down Expand Up @@ -102,12 +102,10 @@ public void generateDoraReport(GenerateReportRequest request) {
FetchedData fetchedData = new FetchedData();
if (CollectionUtils.isNotEmpty(request.getPipelineMetrics())) {
GenerateReportRequest pipelineRequest = request.toPipelineRequest();
fetchOriginalData(pipelineRequest, fetchedData);
generatePipelineReport(pipelineRequest, fetchedData);
}
if (CollectionUtils.isNotEmpty(request.getSourceControlMetrics())) {
GenerateReportRequest sourceControlRequest = request.toSourceControlRequest();
fetchOriginalData(sourceControlRequest, fetchedData);
generateSourceControlReport(sourceControlRequest, fetchedData);
}
generateCSVForPipeline(request, fetchedData.getBuildKiteData());
Expand All @@ -121,6 +119,7 @@ private void generatePipelineReport(GenerateReportRequest request, FetchedData f
request.getPipelineMetrics(), request.getConsiderHoliday(), request.getStartTime(),
request.getEndTime(), pipelineReportId);
try {
fetchOriginalData(request, fetchedData);
saveReporterInHandler(generatePipelineReporter(request, fetchedData), pipelineReportId);
log.info(
"Successfully generate pipeline report, _metrics: {}, _considerHoliday: {}, _startTime: {}, _endTime: {}, _pipelineReportId: {}",
Expand All @@ -131,6 +130,9 @@ private void generatePipelineReport(GenerateReportRequest request, FetchedData f
asyncExceptionHandler.put(pipelineReportId, e);
if (List.of(401, 403, 404).contains(e.getStatus()))
asyncMetricsDataHandler.updateMetricsDataCompletedInHandler(request.getDoraReportId(), DORA);
if (Objects.equals(400, e.getStatus())) {
throw e;
}
}
}

Expand All @@ -141,6 +143,7 @@ private void generateSourceControlReport(GenerateReportRequest request, FetchedD
request.getSourceControlMetrics(), request.getConsiderHoliday(), request.getStartTime(),
request.getEndTime(), sourceControlReportId);
try {
fetchOriginalData(request, fetchedData);
saveReporterInHandler(generateSourceControlReporter(request, fetchedData), sourceControlReportId);
log.info(
"Successfully generate source control report, _metrics: {}, _considerHoliday: {}, _startTime: {}, _endTime: {}, _sourceControlReportId: {}",
Expand All @@ -151,6 +154,9 @@ private void generateSourceControlReport(GenerateReportRequest request, FetchedD
asyncExceptionHandler.put(sourceControlReportId, e);
if (List.of(401, 403, 404).contains(e.getStatus()))
asyncMetricsDataHandler.updateMetricsDataCompletedInHandler(request.getDoraReportId(), DORA);
if (Objects.equals(400, e.getStatus())) {
throw e;
}
}
}

Expand Down Expand Up @@ -265,7 +271,7 @@ private void saveReporterInHandler(ReportResponse reportContent, String reportId
asyncReportRequestHandler.putReport(reportId, reportContent);
}

private ErrorInfo handleAsyncExceptionAndGetErrorInfo(BaseException exception) {
private ErrorInfo handleAsyncExceptionAndGetErrorInfo(AsyncExceptionDTO exception) {
if (Objects.nonNull(exception)) {
int status = exception.getStatus();
final String errorMessage = exception.getMessage();
Expand Down Expand Up @@ -349,9 +355,9 @@ public ReportResponse getComposedReportResponse(String reportId) {
}

private ReportMetricsError getReportErrorAndHandleAsyncException(String reportId) {
BaseException boardException = asyncExceptionHandler.get(IdUtil.getBoardReportId(reportId));
BaseException pipelineException = asyncExceptionHandler.get(IdUtil.getPipelineReportId(reportId));
BaseException sourceControlException = asyncExceptionHandler.get(IdUtil.getSourceControlReportId(reportId));
AsyncExceptionDTO boardException = asyncExceptionHandler.get(IdUtil.getBoardReportId(reportId));
AsyncExceptionDTO pipelineException = asyncExceptionHandler.get(IdUtil.getPipelineReportId(reportId));
AsyncExceptionDTO sourceControlException = asyncExceptionHandler.get(IdUtil.getSourceControlReportId(reportId));
return ReportMetricsError.builder()
.boardMetricsError(handleAsyncExceptionAndGetErrorInfo(boardException))
.pipelineMetricsError(handleAsyncExceptionAndGetErrorInfo(pipelineException))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@RequiredArgsConstructor
public class WorkDay {

private static final long ONE_DAY = 1000 * 60 * 60 * 24;
private static final long ONE_DAY = 1000L * 60 * 60 * 24;

private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ private LeadTime getLeadTimeByPullRequest(String realToken, PipelineInfoOfReposi
}

Optional<PullRequestInfo> mergedPull = pullRequestInfos.stream()
.filter(gitHubPull -> gitHubPull.getMergedAt() != null)
.filter(gitHubPull -> gitHubPull.getMergedAt() != null
&& gitHubPull.getUrl().contains(item.getRepository()))
.min(Comparator.comparing(PullRequestInfo::getNumber));

if (mergedPull.isEmpty()) {
Expand Down
2 changes: 2 additions & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ springdoc:
path: /api-docs

heartbeat:
swagger:
host: ${SWAGGER_HOST:http://localhost:4322}
version: 1.1.5

2 changes: 1 addition & 1 deletion backend/src/test/java/heartbeat/TestFixtures.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class TestFixtures {

public static final String GITHUB_TOKEN = "ghp_12345jhgyui987654rdef43567yhu7654321"; // gitleaks:allow
public static final String GITHUB_TOKEN = "ghp_" + "12345j".repeat(6);

public static final String BUILDKITE_TOKEN = "bkua_6xxxafcc3bxxxxxxb8xxx8d8dxxxf7897cc8b2f1";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package heartbeat.handler;

import heartbeat.exception.BaseException;
import heartbeat.exception.GenerateReportException;
import heartbeat.exception.UnauthorizedException;
import heartbeat.handler.base.AsyncExceptionDTO;
import heartbeat.util.IdUtil;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterAll;
Expand Down Expand Up @@ -162,7 +162,7 @@ void shouldPutAndRemoveAsyncException() {
String boardReportId = IdUtil.getBoardReportId(currentTime);
asyncExceptionHandler.put(boardReportId, new UnauthorizedException("test"));

BaseException baseException = asyncExceptionHandler.remove(boardReportId);
AsyncExceptionDTO baseException = asyncExceptionHandler.remove(boardReportId);

assertEquals(HttpStatus.UNAUTHORIZED.value(), baseException.getStatus());
assertEquals("test", baseException.getMessage());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package heartbeat.handler.base;

import heartbeat.exception.BaseException;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -12,7 +11,7 @@ void testAsyncExceptionDTOInheritance() {
String expectedMessage = "Test Message";
int expectedStatus = 404;

BaseException baseException = new AsyncExceptionDTO(expectedMessage, expectedStatus);
AsyncExceptionDTO baseException = new AsyncExceptionDTO(expectedMessage, expectedStatus);

assertEquals(expectedMessage, baseException.getMessage());
assertEquals(expectedStatus, baseException.getStatus());
Expand Down
Loading
Loading