Skip to content

Commit

Permalink
Update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanNemeth committed Feb 17, 2025
1 parent d70a38f commit be33d0b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
[ngClass]="['flex items-center gap-2 w-full p-2 rounded mb-2 mt-8', hasTestSuites() ? 'hover:bg-gray-100' : '']"
(click)="isTestResultsCollapsed = !isTestResultsCollapsed"
>
<h3 class="text-lg">Test suites</h3>
<h3 class="text-lg">Test Results</h3>

@if (isProcessing()) {
<p-tag class="ml-2" severity="warn" [rounded]="true" [pTooltip]="'Test results are being processed'">
<i-tabler name="progress" class="!size-5 animate-spin"></i-tabler>

<span class="text-sm text-gray-600">Processing</span>
</p-tag>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.tum.cit.aet.helios.workflow.WorkflowRunRepository;
import java.io.FilterInputStream;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
Expand Down Expand Up @@ -41,6 +42,13 @@ public boolean shouldProcess(WorkflowRun workflowRun) {
return false;
}

// If it's older than 2 hours from now, don't process it. That should usually not
// happen. But in case we are receiving old events from NATS, we should not risk
// processing a lot of old runs (e.g. when the server was down).
if (workflowRun.getUpdatedAt().plusHours(2).isBefore(OffsetDateTime.now())) {
return false;
}

return workflowRun.getTestProcessingStatus() == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ create unique index idx_test_suite_run_name on test_suite (workflow_run_id, name
alter table workflow
drop constraint workflow_label_check;

alter table workflow_run add constraint fk_workflow_run_workflow foreign key (workflow_id) references workflow (id);
alter table workflow add constraint workflow_label_check CHECK (((label)::text = ANY ((ARRAY['TEST'::character varying, 'BUILD'::character varying, 'DEPLOYMENT'::character varying, 'NONE'::character varying])::text[])));

-- We need to remove all workflow run records that are not associated with a workflow
-- (There shouldn't be any, but just in case)
delete from workflow_run where workflow_id not in (select id from workflow);

alter table workflow_run add constraint fk_workflow_run_workflow foreign key (workflow_id) references workflow (id) on delete cascade;

alter table workflow_run
add column test_processing_status varchar(20);
Expand Down

0 comments on commit be33d0b

Please sign in to comment.