Skip to content

Commit 859a253

Browse files
committed
Fix tests
1 parent 904661a commit 859a253

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloud.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public class KubernetesCloud extends Cloud implements PodTemplateGroup {
148148
public KubernetesCloud(String name) {
149149
super(name);
150150
setMaxRequestsPerHost(DEFAULT_MAX_REQUESTS_PER_HOST);
151-
setPodLabels(PodLabel.fromMap(DEFAULT_POD_LABELS));
151+
setPodLabels(null);
152152
}
153153

154154
/**
@@ -466,9 +466,7 @@ public List<PodLabel> getPodLabels() {
466466
@DataBoundSetter
467467
public void setPodLabels(@CheckForNull List<PodLabel> labels) {
468468
this.podLabels = new ArrayList<>();
469-
if (labels != null) {
470-
this.podLabels.addAll(labels);
471-
}
469+
this.podLabels.addAll(labels == null || labels.isEmpty() ? PodLabel.fromMap(DEFAULT_POD_LABELS) : labels);
472470
}
473471

474472
/**
@@ -999,8 +997,8 @@ private Object readResolve() {
999997
if (waitForPodSec == null) {
1000998
waitForPodSec = DEFAULT_WAIT_FOR_POD_SEC;
1001999
}
1002-
if (podLabels == null && labels != null) {
1003-
setPodLabels(PodLabel.fromMap(labels));
1000+
if (podLabels == null) {
1001+
setPodLabels(labels == null ? null : PodLabel.fromMap(labels));
10041002
}
10051003
if (containerCap != null && containerCap == 0) {
10061004
containerCap = null;

0 commit comments

Comments
 (0)