From dbe980d765c42f17aac7c6626bb9edf25dc97d55 Mon Sep 17 00:00:00 2001
From: Ludek Novy <13610612+ludeknovy@users.noreply.github.com>
Date: Sun, 9 Jan 2022 11:21:44 +0100
Subject: [PATCH] test housekeeping (#206)
---
src/app/scenario.service.model.ts | 1 +
.../scenario-settings.component.html | 14 ++++++
.../scenario-settings.component.ts | 45 ++++++++++++++++---
3 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/src/app/scenario.service.model.ts b/src/app/scenario.service.model.ts
index c6933300..5cdccd01 100644
--- a/src/app/scenario.service.model.ts
+++ b/src/app/scenario.service.model.ts
@@ -2,6 +2,7 @@ export interface Scenario {
analysisEnabled: boolean;
zeroErrorToleranceEnabled: boolean;
name: string;
+ keepTestRunsPeriod: number;
thresholds: {
enabled: boolean;
percentile: number;
diff --git a/src/app/scenario/scenario-settings/scenario-settings.component.html b/src/app/scenario/scenario-settings/scenario-settings.component.html
index 4446de0b..04cc8aed 100644
--- a/src/app/scenario/scenario-settings/scenario-settings.component.html
+++ b/src/app/scenario/scenario-settings/scenario-settings.component.html
@@ -42,6 +42,18 @@
Thresholds
+
+
+
+
diff --git a/src/app/scenario/scenario-settings/scenario-settings.component.ts b/src/app/scenario/scenario-settings/scenario-settings.component.ts
index e2d71ba2..d50c5010 100644
--- a/src/app/scenario/scenario-settings/scenario-settings.component.ts
+++ b/src/app/scenario/scenario-settings/scenario-settings.component.ts
@@ -27,16 +27,46 @@ export class SettingsScenarioComponent implements OnInit {
enabled: null,
zeroErrorToleranceEnabled: null,
deleteSamples: null,
+ keepTestRunsPeriod: null,
};
params;
+ keepTestRunPeriods = [
+ {
+ period: 0,
+ description: "forever",
+ },
+ {
+ period: 7,
+ description: "7 days",
+ },
+ {
+ period: 14,
+ description: "14 days"
+ },
+ {
+ period: 30,
+ description: "30 days",
+ },
+ {
+ period: 90,
+ description: "90 days"
+ },
+ {
+ period: 180,
+ description: "180 days",
+ }
+ ];
+
constructor(
private route: ActivatedRoute,
private modalService: NgbModal,
private scenarioApiService: ScenarioApiService,
private notification: NotificationMessage,
- ) { }
+ ) {
+ }
+
ngOnInit(): void {
this.route.params.subscribe(_ => this.params = _);
this.scenarioApiService.getScenario(this.params.projectName, this.params.scenarioName).subscribe(_ => {
@@ -78,6 +108,9 @@ export class SettingsScenarioComponent implements OnInit {
this.formControls.deleteSamples = new FormControl(settings.deleteSamples, [
Validators.required
]);
+ this.formControls.keepTestRunsPeriod = new FormControl(settings.keepTestRunsPeriod, [
+ Validators.required
+ ]);
}
createForm() {
@@ -90,6 +123,7 @@ export class SettingsScenarioComponent implements OnInit {
thresholdErrorRate: this.formControls.errorRate,
zeroErrorToleranceEnabled: this.formControls.zeroErrorToleranceEnabled,
deleteSamples: this.formControls.deleteSamples,
+ keepTestRunsPeriod: this.formControls.keepTestRunsPeriod,
});
}
@@ -103,19 +137,20 @@ export class SettingsScenarioComponent implements OnInit {
const {
scenarioName, analysisEnabled,
thresholdEnabled, thresholdErrorRate,
- thresholdPercentile, thresholdThroughput, deleteSamples, zeroErrorToleranceEnabled } = this.scenarioSettingsForm.value;
+ thresholdPercentile, thresholdThroughput, deleteSamples, zeroErrorToleranceEnabled, keepTestRunsPeriod
+ } = this.scenarioSettingsForm.value;
const { projectName, scenarioName: currentScenarioName } = this.params;
-
const body = {
scenarioName,
analysisEnabled,
zeroErrorToleranceEnabled,
+ keepTestRunsPeriod,
deleteSamples,
thresholds: {
enabled: thresholdEnabled,
- errorRate: parseFloat(thresholdErrorRate),
+ errorRate: parseFloat(thresholdErrorRate),
throughput: parseFloat(thresholdThroughput),
- percentile: parseFloat(thresholdPercentile)
+ percentile: parseFloat(thresholdPercentile)
}
};