Rename ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT to ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE - to match real value (#2787)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -115,7 +115,7 @@ public class TenantConfigurationProperties {
|
|||||||
/**
|
/**
|
||||||
* Configuration value for percentage of oldest actions to be cleaned if @maxActionsPerTarget quota is hit
|
* Configuration value for percentage of oldest actions to be cleaned if @maxActionsPerTarget quota is hit
|
||||||
*/
|
*/
|
||||||
public static final String ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT = "action.cleanup.onQuotaHit.percent";
|
public static final String ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE = "action.cleanup.onQuotaHit.percent";
|
||||||
/**
|
/**
|
||||||
* Switch to enable/disable the multi-assignment feature.
|
* Switch to enable/disable the multi-assignment feature.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties;
|
|
||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||||
import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
import org.eclipse.hawkbit.utils.TenantConfigHelper;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||||
@@ -629,7 +628,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getActionsPurgePercentage() {
|
private int getActionsPurgePercentage() {
|
||||||
return getConfigValue(TenantConfigurationKey.ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT, Integer.class);
|
return getConfigValue(TenantConfigurationKey.ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE, Integer.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isActionsAutocloseEnabled() {
|
protected boolean isActionsAutocloseEnabled() {
|
||||||
|
|||||||
@@ -1649,7 +1649,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
() -> assignDistributionSet(exceededQuotaDsAssign.getId(), target.getControllerId()));
|
() -> assignDistributionSet(exceededQuotaDsAssign.getId(), target.getControllerId()));
|
||||||
|
|
||||||
// set purge config to 25 %
|
// set purge config to 25 %
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT, 25);
|
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE, 25);
|
||||||
|
|
||||||
// assign again
|
// assign again
|
||||||
assignDistributionSet(exceededQuotaDsAssign.getId(), target.getControllerId());
|
assignDistributionSet(exceededQuotaDsAssign.getId(), target.getControllerId());
|
||||||
@@ -1688,7 +1688,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
assertEquals(20, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
assertEquals(20, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
||||||
|
|
||||||
// set purge config to 25 %
|
// set purge config to 25 %
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT, 25);
|
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE, 25);
|
||||||
rolloutHandler.handleAll();
|
rolloutHandler.handleAll();
|
||||||
assertEquals(16, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
assertEquals(16, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
||||||
|
|
||||||
@@ -1709,7 +1709,7 @@ class DeploymentManagementTest extends AbstractJpaIntegrationTest {
|
|||||||
rolloutHandler.handleAll();
|
rolloutHandler.handleAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_PURGE_PERCENTAGE_ON_QUOTA_HIT, 25);
|
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ACTION_CLEANUP_ON_QUOTA_HIT_PERCENTAGE, 25);
|
||||||
deploymentManagement.handleMaxAssignmentsExceeded(target.getId(), 5L, new AssignmentQuotaExceededException());
|
deploymentManagement.handleMaxAssignmentsExceeded(target.getId(), 5L, new AssignmentQuotaExceededException());
|
||||||
// only 3 actions should be deleted in such case :
|
// only 3 actions should be deleted in such case :
|
||||||
assertEquals(15, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
assertEquals(15, deploymentManagement.countActionsByTarget(target.getControllerId()));
|
||||||
|
|||||||
Reference in New Issue
Block a user