This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 57381d1289c5 CAMEL-26934: camel-jbang-plugin-kubernetes - the volumes
of a pod have different names, --property takes a value that is a path, and a
cron schedule keeps its commas (#30024)
57381d1289c5 is described below
commit 57381d1289c5c10fd502953da23bcb8949edc4ed
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 15 16:35:58 2026 +0100
CAMEL-26934: camel-jbang-plugin-kubernetes - the volumes of a pod have
different names, --property takes a value that is a path, and a cron schedule
keeps its commas (#30024)
- A volume was named after its configmap, secret or claim, so --config
configmap:db --config secret:db, or two keys of
one configmap, gave two volumes of the same name, which the API server
refuses. A second volume of the same name now
gets -2, a third -3, and so on; the first keeps its name.
- kubernetes run --property took any value with a / for a properties file
(camel.server.path=/api), which did not exist
and was left out without a word. A key=value is a property; a properties
file that does not exist exits with 66.
- A trait value with a comma was split into a list also when quoted, and
cronjob.schedule=0 1,13 * * * failed with a
Jackson error (exit 70). A quoted value, and a schedule, is one value.
CAMEL-26934: camel-jbang-plugin-kubernetes - the key=value hint only for a
--property that is not file:path (review)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 11 ++++
.../core/commands/kubernetes/KubernetesRun.java | 51 ++++++++++++------
.../commands/kubernetes/traits/MountTrait.java | 26 ++++++++-
.../commands/kubernetes/traits/TraitHelper.java | 27 +++++++---
.../commands/kubernetes/KubernetesExportTest.java | 38 ++++++++++---
.../kubernetes/KubernetesRunPropertiesTest.java | 62 ++++++++++++++++++++++
.../kubernetes/traits/TraitHelperTest.java | 15 ++++++
7 files changed, 198 insertions(+), 32 deletions(-)
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index b260079db043..ce445e3773fa 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -3398,6 +3398,17 @@ file), the command asks there whether to overwrite the
file.
`2`: the first showed every error, the second none. The errors of
`--diagram` are printed on stderr, and a graphical
`--theme` in a terminal without graphics exits with `2`.
+=== camel-jbang - camel kubernetes volumes, --property and trait values
+
+* The volumes of `--config`, `--resource` and `--volume` have different names
in the pod: a second volume of the same
+ name gets `-2`, a third `-3` and so on (`--config configmap:db --config
secret:db` gives the volumes `db` and `db-2`).
+ Such manifests had two volumes of the same name, which the API server
refuses.
+* `camel kubernetes run --property` takes a `key=value` whose value is a path,
such as `camel.server.path=/api`, as a
+ property: it was taken for a properties file, and left out. A properties
file that does not exist exits with `66`;
+ it was ignored.
+* A quoted trait value, and the value of `cronjob.schedule`, is one value also
with a comma in it
+ (`cronjob.schedule=0 1,13 * * *`): it was split into a list, which failed
with exit code `70`.
+
=== camel-jbang - camel version list
* `camel version list` prints the `Last updated` note on stderr, so stdout has
the table only.
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java
index aff44f525faf..e9265db20ce9 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java
@@ -317,23 +317,7 @@ public class KubernetesRun extends KubernetesBaseCommand {
}
// merge the properties from files
if (properties != null) {
- List<String> definiteProperties = new ArrayList<>();
- for (String p : properties) {
- if (p.startsWith("file:") || p.contains(File.separator)) {
- String filename = p.startsWith("file:") ?
p.substring("file:".length()) : p;
- File f = new File(filename);
- if (f.exists()) {
- Properties prop = new Properties();
- try (FileInputStream input = new FileInputStream(f)) {
- prop.load(input);
- }
- prop.forEach((k, v) -> definiteProperties.add(k + "="
+ v));
- }
- } else {
- definiteProperties.add(p);
- }
- }
- properties = definiteProperties.toArray(new
String[definiteProperties.size()]);
+ properties = mergeProperties(properties);
}
// when user sets configuration or resources from configmap/secret
// the projected properties files must be set in the app runtime
@@ -904,6 +888,39 @@ public class KubernetesRun extends KubernetesBaseCommand {
}
}
+ /**
+ * The properties of --property: a key=value, or the properties of a file
(file:path, or a path). A key=value is a
+ * property also when its value is a path, such as camel.server.path=/api,
which was taken for a file that does not
+ * exist and silently left out (CAMEL-26934).
+ *
+ * @throws CliException with exit code 66 for a properties file that does
not exist
+ */
+ static String[] mergeProperties(String[] properties) throws IOException {
+ List<String> definiteProperties = new ArrayList<>();
+ for (String p : properties) {
+ int eq = p.indexOf('=');
+ String key = eq > 0 ? p.substring(0, eq) : null;
+ boolean keyValue = key != null && !key.contains("/") &&
!key.contains(File.separator);
+ if (p.startsWith("file:") || !keyValue) {
+ String filename = p.startsWith("file:") ?
p.substring("file:".length()) : p;
+ File f = new File(filename);
+ if (!f.isFile()) {
+ // the hint only when it may have been meant as a
property, not for file:path (review)
+ String hint = p.startsWith("file:") ? "" : " (a property
is given as key=value)";
+ throw CliException.fileNotFound("Properties file does not
exist: " + filename + hint);
+ }
+ Properties prop = new Properties();
+ try (FileInputStream input = new FileInputStream(f)) {
+ prop.load(input);
+ }
+ prop.forEach((k, v) -> definiteProperties.add(k + "=" + v));
+ } else {
+ definiteProperties.add(p);
+ }
+ }
+ return definiteProperties.toArray(new String[0]);
+ }
+
/*
* When a configmap/secret is projected as a properties file and mounted
into the running pod
* and the properties file must be set at runtime to be discovered by the
camel runtime
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/MountTrait.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/MountTrait.java
index f76b8cacfdc9..814794cc0606 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/MountTrait.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/MountTrait.java
@@ -21,8 +21,10 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import io.fabric8.kubernetes.api.model.ConfigMapVolumeSourceBuilder;
import io.fabric8.kubernetes.api.model.KeyToPathBuilder;
@@ -153,7 +155,7 @@ public class MountTrait extends BaseTrait {
}
private void mountResource(List<Volume> volumes, List<VolumeMount>
volumeMounts, MountResource mountResource) {
- String volumeName = KubernetesHelper.sanitize(mountResource.name);
+ String volumeName = uniqueVolumeName(volumes,
KubernetesHelper.sanitize(mountResource.name));
String dstDir =
Optional.ofNullable(mountResource.destinationPath).orElse("");
String dstFile;
boolean overrideFilePath = false;
@@ -172,6 +174,28 @@ public class MountTrait extends BaseTrait {
volumeMounts.add(mnt);
}
+ /**
+ * The name of a volume, unique in the pod: the volumes of a pod must have
different names, and the name of a volume
+ * is the name of its configmap, secret or claim, so --config configmap:db
--config secret:db, or two keys of one
+ * configmap, gave two volumes of the same name, which the API server
refuses (CAMEL-26934). The first volume keeps
+ * the name, the next ones get -2, -3 and so on.
+ */
+ static String uniqueVolumeName(List<Volume> volumes, String name) {
+ Set<String> taken =
volumes.stream().map(Volume::getName).collect(Collectors.toSet());
+ if (!taken.contains(name)) {
+ return name;
+ }
+ for (int i = 2;; i++) {
+ String suffix = "-" + i;
+ // a volume name is at most 63 characters (a DNS label)
+ String base = name.length() + suffix.length() > 63 ?
name.substring(0, 63 - suffix.length()) : name;
+ String candidate = base + suffix;
+ if (!taken.contains(candidate)) {
+ return candidate;
+ }
+ }
+ }
+
private VolumeMount getMount(
String volumeName, String mountPath, String subPath, boolean
readOnly, boolean overrideFilePath) {
String adjustedMountPath = mountPath + "/" + subPath;
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelper.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelper.java
index c79f084ea6b6..bc5c040e91bb 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelper.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelper.java
@@ -168,6 +168,15 @@ public final class TraitHelper {
return Boolean.valueOf(value);
}
+ // a quoted value is one value, also with a comma in it, and so is a
cron schedule, as in 0 1,13 * * *, which
+ // was split into a list that the trait cannot take (CAMEL-26934)
+ if (isQuoted(value)) {
+ return value.substring(1, value.length() - 1);
+ }
+ if (traitKey.equalsIgnoreCase("schedule")) {
+ return value;
+ }
+
if (value.startsWith("[") && value.endsWith("]")) {
String valueArrayExpression = value.substring(1, value.length() -
1);
List<String> values = new ArrayList<>();
@@ -187,14 +196,6 @@ public final class TraitHelper {
return values;
}
- if (value.startsWith("\"") && value.endsWith("\"")) {
- return value.substring(1, value.length() - 1);
- }
-
- if (value.startsWith("'") && value.endsWith("'")) {
- return value.substring(1, value.length() - 1);
- }
-
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
@@ -202,6 +203,16 @@ public final class TraitHelper {
}
}
+ // one quoted value, not a list of quoted values such as 'a=1','b=2'
+ private static boolean isQuoted(String value) {
+ if (value.length() < 2) {
+ return false;
+ }
+ char quote = value.charAt(0);
+ return (quote == '"' || quote == '\'') && value.charAt(value.length()
- 1) == quote
+ && value.substring(1, value.length() - 1).indexOf(quote) == -1;
+ }
+
public static void configureConnects(Traits traitsSpec, String[] connects)
{
if (connects == null || connects.length == 0) {
return;
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
index 332561c3eb4b..1edfb5786eda 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesExportTest.java
@@ -744,8 +744,8 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
Assertions.assertEquals("foo", volumeMounts.get(0).getName());
Assertions.assertEquals("/etc/camel/conf.d/_secrets/foo",
volumeMounts.get(0).getMountPath().replace('\\', '/'));
Assertions.assertTrue(volumeMounts.get(0).getReadOnly());
- // secret:foo/key-foo
- Assertions.assertEquals("foo", volumeMounts.get(1).getName());
+ // secret:foo/key-foo: a volume of its own, so a name of its own
(CAMEL-26934)
+ Assertions.assertEquals("foo-2", volumeMounts.get(1).getName());
Assertions.assertEquals("/etc/camel/conf.d/_secrets/foo/key-foo",
volumeMounts.get(1).getMountPath().replace('\\', '/'));
Assertions.assertTrue(volumeMounts.get(1).getReadOnly());
@@ -756,7 +756,7 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
Assertions.assertEquals("/etc/camel/conf.d/_configmaps/bar",
volumeMounts.get(2).getMountPath().replace('\\', '/'));
Assertions.assertTrue(volumeMounts.get(2).getReadOnly());
// configmap:bar/key-bar
- Assertions.assertEquals("bar", volumeMounts.get(3).getName());
+ Assertions.assertEquals("bar-2", volumeMounts.get(3).getName());
Assertions.assertEquals("/etc/camel/conf.d/_configmaps/bar/key-bar",
volumeMounts.get(3).getMountPath().replace('\\', '/'));
Assertions.assertTrue(volumeMounts.get(3).getReadOnly());
@@ -768,6 +768,7 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
volumeMounts.get(4).getMountPath().replace('\\', '/'));
Assertions.assertEquals("my.properties",
volumes.get(4).getConfigMap().getItems().get(0).getKey());
Assertions.assertEquals("my.properties",
volumes.get(4).getConfigMap().getItems().get(0).getPath());
+ assertVolumeNames(volumes, volumeMounts, "foo", "foo-2", "bar",
"bar-2", "bar2");
}
@Test
@@ -791,13 +792,13 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
Assertions.assertEquals("/etc/camel/resources.d/_secrets/foo",
volumeMounts.get(0).getMountPath().replace('\\', '/'));
Assertions.assertTrue(volumeMounts.get(0).getReadOnly());
// secret:foo/key-foo
- Assertions.assertEquals("foo", volumeMounts.get(1).getName());
+ Assertions.assertEquals("foo-2", volumeMounts.get(1).getName());
Assertions.assertEquals("/etc/camel/resources.d/_secrets/foo/key-foo",
volumeMounts.get(1).getMountPath().replace('\\', '/'));
Assertions.assertEquals("key-foo",
volumes.get(1).getSecret().getItems().get(0).getKey());
Assertions.assertEquals("key-foo",
volumes.get(1).getSecret().getItems().get(0).getPath());
// secret:foo/key-foo@/etc/foodir/my-file.txt
- Assertions.assertEquals("foo", volumeMounts.get(2).getName());
+ Assertions.assertEquals("foo-3", volumeMounts.get(2).getName());
Assertions.assertEquals("/etc/foodir/my-file.txt",
volumeMounts.get(2).getMountPath().replace('\\', '/'));
Assertions.assertEquals("my-file.txt",
volumeMounts.get(2).getSubPath());
Assertions.assertEquals("key-foo",
volumes.get(2).getSecret().getItems().get(0).getKey());
@@ -807,7 +808,7 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
Assertions.assertEquals("/etc/camel/resources.d/_configmaps/bar",
volumeMounts.get(3).getMountPath().replace('\\', '/'));
// configmap:bar/key-bar
- Assertions.assertEquals("bar", volumeMounts.get(4).getName());
+ Assertions.assertEquals("bar-2", volumeMounts.get(4).getName());
Assertions.assertEquals("/etc/camel/resources.d/_configmaps/bar/key-bar",
volumeMounts.get(4).getMountPath().replace('\\', '/'));
Assertions.assertEquals("key-bar",
volumes.get(4).getConfigMap().getItems().get(0).getKey());
@@ -818,6 +819,31 @@ class KubernetesExportTest extends
KubernetesExportBaseTestSupport {
Assertions.assertEquals("bar.bin", volumeMounts.get(5).getSubPath());
Assertions.assertEquals("my.properties",
volumes.get(5).getConfigMap().getItems().get(0).getKey());
Assertions.assertEquals("bar.bin",
volumes.get(5).getConfigMap().getItems().get(0).getPath());
+ assertVolumeNames(volumes, volumeMounts, "foo", "foo-2", "foo-3",
"bar", "bar-2", "bar2");
+ }
+
+ @Test
+ public void aConfigmapAndASecretOfTheSameNameAreTwoVolumes() throws
Exception {
+ // CAMEL-26934: both volumes were named db, which the API server
refuses
+ KubernetesExport command = createCommand(new String[] {
"classpath:route.yaml" }, "--runtime=" + RuntimeType.main);
+ command.configs = new String[] { "configmap:db", "secret:db" };
+ var exit = command.doCall();
+ Assertions.assertEquals(0, exit);
+
+ Deployment deployment = getDeployment(RuntimeType.main);
+ List<Volume> volumes =
deployment.getSpec().getTemplate().getSpec().getVolumes();
+ List<VolumeMount> volumeMounts =
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getVolumeMounts();
+ assertVolumeNames(volumes, volumeMounts, "db", "db-2");
+ Assertions.assertEquals("db", volumes.get(0).getConfigMap().getName());
+ Assertions.assertEquals("db",
volumes.get(1).getSecret().getSecretName());
+ Assertions.assertEquals("/etc/camel/conf.d/_configmaps/db",
volumeMounts.get(0).getMountPath().replace('\\', '/'));
+ Assertions.assertEquals("/etc/camel/conf.d/_secrets/db",
volumeMounts.get(1).getMountPath().replace('\\', '/'));
+ }
+
+ // the volumes have these names, and each mount names its own volume
+ private static void assertVolumeNames(List<Volume> volumes,
List<VolumeMount> volumeMounts, String... names) {
+ Assertions.assertEquals(List.of(names),
volumes.stream().map(Volume::getName).toList());
+ Assertions.assertEquals(List.of(names),
volumeMounts.stream().map(VolumeMount::getName).toList());
}
@Test
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunPropertiesTest.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunPropertiesTest.java
new file mode 100644
index 000000000000..d3cdaa435d01
--- /dev/null
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRunPropertiesTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.kubernetes;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.camel.dsl.jbang.core.common.CliException;
+import org.apache.camel.dsl.jbang.core.common.CliExitCode;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The --property values of camel kubernetes run: a key=value, or the
properties of a file (CAMEL-26934).
+ */
+class KubernetesRunPropertiesTest {
+
+ @TempDir
+ Path dir;
+
+ @Test
+ void aValueThatIsAPathIsAProperty() throws Exception {
+ // was taken for a file that does not exist, and left out
+ assertArrayEquals(new String[] { "camel.server.path=/api",
"greeting=hello" },
+ KubernetesRun.mergeProperties(new String[] {
"camel.server.path=/api", "greeting=hello" }));
+ }
+
+ @Test
+ void thePropertiesOfAFile() throws Exception {
+ Path file = Files.writeString(dir.resolve("my.properties"),
"foo=bar\n");
+
+ assertArrayEquals(new String[] { "foo=bar" },
KubernetesRun.mergeProperties(new String[] { file.toString() }));
+ assertArrayEquals(new String[] { "foo=bar" },
KubernetesRun.mergeProperties(new String[] { "file:" + file }));
+ }
+
+ @Test
+ void aPropertiesFileThatDoesNotExistIsNotFound() {
+ CliException e = assertThrows(CliException.class,
+ () -> KubernetesRun.mergeProperties(new String[] {
dir.resolve("nope.properties").toString() }));
+ assertEquals(CliExitCode.FILE_NOT_FOUND, e.getExitCode());
+ assertTrue(e.getMessage().startsWith("Properties file does not exist:
"), e.getMessage());
+ }
+}
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelperTest.java
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelperTest.java
index 62549c2e483b..6e7f407fec6d 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelperTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/test/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/traits/TraitHelperTest.java
@@ -107,4 +107,19 @@ public class TraitHelperTest {
Traits traitsSpecNull = TraitHelper.parseTraits(null);
Assertions.assertNotNull(traitsSpecNull);
}
+
+ @Test
+ public void aCronScheduleWithACommaIsOneValue() {
+ // CAMEL-26934: the schedule was split at the comma into a list, which
failed with a Jackson error (exit 70)
+ Traits traits = TraitHelper.parseTraits(new String[] {
"cronjob.schedule=0 1,13 * * *" });
+
+ Assertions.assertEquals("0 1,13 * * *",
traits.getCronjob().getSchedule());
+ }
+
+ @Test
+ public void aQuotedValueWithACommaIsOneValue() {
+ Traits traits = TraitHelper.parseTraits(new String[] {
"cronjob.timezone=\"Europe/Paris,Europe/Rome\"" });
+
+ Assertions.assertEquals("Europe/Paris,Europe/Rome",
traits.getCronjob().getTimezone());
+ }
}