forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better encapsulation of KubernetesEnvBuildItem behavior
This is needed to be able to address quarkusio#9629. Things are still not completely working but getting there.
- Loading branch information
Showing
6 changed files
with
186 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ns/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright 2020 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* <p> | ||
* Licensed 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 io.quarkus.kubernetes.spi; | ||
|
||
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create; | ||
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.configmap; | ||
import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.var; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author <a href="[email protected]">Christophe Laprun</a> | ||
*/ | ||
public class KubernetesEnvBuildItemTest { | ||
|
||
private static final String TARGET = "target"; | ||
private static final String VALUE = "value"; | ||
private static final String NAME = "name"; | ||
|
||
@Test | ||
public void testCreateSimpleVarFromEnvConfig() { | ||
final KubernetesEnvBuildItem item = create(NAME, VALUE, null, null, null, TARGET); | ||
assertEquals(var, item.getType()); | ||
assertEquals(NAME, item.getName()); | ||
assertEquals(VALUE, item.getValue()); | ||
assertEquals(TARGET, item.getTarget()); | ||
assertNull(item.getConfigMap()); | ||
assertNull(item.getSecret()); | ||
assertNull(item.getField()); | ||
} | ||
|
||
@Test | ||
public void testCreateLoadFromConfigMapFromEnvConfig() { | ||
final KubernetesEnvBuildItem item = create(NAME, null, null, VALUE, null, TARGET); | ||
assertEquals(configmap, item.getType()); | ||
assertEquals(NAME, item.getName()); | ||
assertNull(item.getValue()); | ||
assertEquals(VALUE, item.getConfigMap()); | ||
assertNull(item.getSecret()); | ||
assertNull(item.getField()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.