Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<exclude name="ShortVariable" />
<exclude name="TooManyStaticImports" />
<exclude name="UseUnderscoresInNumericLiterals" />
<exclude name="UselessParentheses" />
</rule>
<rule ref="category/java/design.xml">
<exclude name="AbstractClassWithoutAnyMethod" />
Expand All @@ -51,7 +50,6 @@
<exclude name="CognitiveComplexity" />
<exclude name="CyclomaticComplexity" />
<exclude name="ExcessiveImports" />
<exclude name="ImmutableField" />
<exclude name="LawOfDemeter" />
<exclude name="NPathComplexity" />
<exclude name="SignatureDeclareThrowsException" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public ApplicationStatus terminateOrRestart(
ApplicationState state =
new ApplicationState(ApplicationStateSummary.ResourceReleased, stateMessageOverride);
if (ResourceRetainPolicy.Always.equals(resourceRetainPolicy)
|| (ResourceRetainPolicy.OnFailure.equals(resourceRetainPolicy)
&& currentState.currentStateSummary.isFailure())) {
|| ResourceRetainPolicy.OnFailure.equals(resourceRetainPolicy)
&& currentState.currentStateSummary.isFailure()) {
state = terminateAppWithoutReleaseResource(stateMessageOverride);
}
return new ApplicationStatus(
Expand All @@ -116,8 +116,8 @@ public ApplicationStatus terminateOrRestart(
ApplicationState state =
new ApplicationState(ApplicationStateSummary.ResourceReleased, stateMessage);
if (ResourceRetainPolicy.Always.equals(resourceRetainPolicy)
|| (ResourceRetainPolicy.OnFailure.equals(resourceRetainPolicy)
&& currentState.currentStateSummary.isFailure())) {
|| ResourceRetainPolicy.OnFailure.equals(resourceRetainPolicy)
&& currentState.currentStateSummary.isFailure()) {
state = terminateAppWithoutReleaseResource(stateMessage);
}
// still use previous & current attempt summary - they are to be updated only upon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static boolean isSentinelResource(HasMetadata resource) {
}

private static boolean shouldSentinelWatchGivenNamespace(String namespace) {
if ((!Utils.getWatchedNamespaces().isEmpty())
if (!Utils.getWatchedNamespaces().isEmpty()
&& !Utils.getWatchedNamespaces().contains(namespace)) {
if (log.isErrorEnabled()) {
log.error("Skip watching sentinel resource in namespace {}", namespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ReconcileProgress reconcile(
String stateMessage = context.getResource().getStatus().getCurrentState().getMessage();
if (instanceConfig == null
|| instanceConfig.getInitExecutors() == 0L
|| (!prevStateSummary.isStarting() && instanceConfig.getMinExecutors() == 0L)) {
|| !prevStateSummary.isStarting() && instanceConfig.getMinExecutors() == 0L) {
proposedStateSummary = ApplicationStateSummary.RunningHealthy;
stateMessage = Constants.RUNNING_HEALTHY_MESSAGE;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void patchAndStatusWithVersionLocked(CR resource, KubernetesClient clien
resource.getMetadata().setResourceVersion(updated.getMetadata().getResourceVersion());
err = null;
} catch (KubernetesClientException e) {
log.error("Error while patching status, retrying {}/{}...", (i + 1), maxRetry, e);
log.error("Error while patching status, retrying {}/{}...", i + 1, maxRetry, e);
Thread.sleep(TimeUnit.SECONDS.toMillis(API_RETRY_ATTEMPT_AFTER_SECONDS.getValue()));
err = e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class HealthProbeTest {
private KubernetesClient kubernetesClient;
private AtomicBoolean isRunning;
private AtomicBoolean isRunning2;
private Map<String, Map<String, InformerWrappingEventSourceHealthIndicator>>
private final Map<String, Map<String, InformerWrappingEventSourceHealthIndicator>>
unhealthyEventSources = new HashMap<>();
private Map<String, Map<String, InformerWrappingEventSourceHealthIndicator>>
private final Map<String, Map<String, InformerWrappingEventSourceHealthIndicator>>
unhealthyEventSources2 = new HashMap<>();

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
import org.apache.spark.k8s.operator.utils.SparkAppStatusRecorder;

class SparkAppReconcilerTest {
private SparkAppStatusRecorder mockRecorder = mock(SparkAppStatusRecorder.class);
private SentinelManager<SparkApplication> mockSentinelManager = mock(SentinelManager.class);
private KubernetesClient mockClient = mock(KubernetesClient.class);
private Context<SparkApplication> mockContext = mock(Context.class);
private Pod mockDriver = mock(Pod.class);
private SparkAppSubmissionWorker mockWorker = mock(SparkAppSubmissionWorker.class);
private final SparkAppStatusRecorder mockRecorder = mock(SparkAppStatusRecorder.class);
private final SentinelManager<SparkApplication> mockSentinelManager = mock(SentinelManager.class);
private final KubernetesClient mockClient = mock(KubernetesClient.class);
private final Context<SparkApplication> mockContext = mock(Context.class);
private final Pod mockDriver = mock(Pod.class);
private final SparkAppSubmissionWorker mockWorker = mock(SparkAppSubmissionWorker.class);
SparkApplication app = new SparkApplication();
SparkAppReconciler reconciler =
new SparkAppReconciler(mockWorker, mockRecorder, mockSentinelManager);
Expand Down