forked from dekorateio/dekorate
-
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.
Test demonstrating issue dekorateio#1000
- Loading branch information
Showing
8 changed files
with
187 additions
and
0 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
Empty file.
82 changes: 82 additions & 0 deletions
82
tests/issue-1000-docker-registry-docker-file-needs-Dockerfile/pom.xml
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,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2018 The original authors. | ||
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 | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>dekorate-tests</artifactId> | ||
<groupId>io.dekorate</groupId> | ||
<version>2.9-SNAPSHOT</version> | ||
<relativePath>../</relativePath> | ||
</parent> | ||
|
||
<groupId>io.dekorate</groupId> | ||
<artifactId>issue-100-docker-registry-docker-file-needs-Dockerfile</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Dekorate :: Tests :: Annotations :: Kubernetes :: Integration Test for #1000</name> | ||
<description>Docker registry is defined</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.dekorate</groupId> | ||
<artifactId>kubernetes-annotations</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<!-- Testing --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${version.maven-surefire-plugin}</version> | ||
<inherited>true</inherited> | ||
<configuration> | ||
<useSystemClassLoader>false</useSystemClassLoader> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${version.maven-compiler-plugin}</version> | ||
<configuration> | ||
<source>${java.source}</source> | ||
<target>${java.target}</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
...-docker-registry-docker-file-needs-Dockerfile/src/main/java/io/dekorate/example/Main.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,27 @@ | ||
/** | ||
* Copyright 2018 The original authors. | ||
* | ||
* 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 | ||
* | ||
* 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 io.dekorate.example; | ||
|
||
import io.dekorate.annotation.Dekorate; | ||
|
||
@Dekorate | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
tests/issue-1000-docker-registry-docker-file-needs-Dockerfile/src/main/resources/Dockerfile
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,4 @@ | ||
FROM openjdk:8u171-alpine3.7 | ||
RUN apk --no-cache add curl | ||
COPY target/*.jar example.jar | ||
CMD java ${JAVA_OPTS} -jar example.jar |
4 changes: 4 additions & 0 deletions
4
...ssue-1000-docker-registry-docker-file-needs-Dockerfile/src/main/resources/application.yml
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,4 @@ | ||
dekorate: | ||
docker: | ||
registry: localhost:3000 | ||
docker-file: src/main/resources/Dockerfile |
53 changes: 53 additions & 0 deletions
53
...registry-docker-file-needs-Dockerfile/src/test/java/io/dekorate/example/Issue420Test.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,53 @@ | ||
/** | ||
* Copyright 2018 The original authors. | ||
* | ||
* 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 | ||
* | ||
* 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 io.dekorate.example; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Optional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.dekorate.utils.Serialization; | ||
import io.fabric8.kubernetes.api.model.Container; | ||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.api.model.KubernetesList; | ||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
|
||
public class Issue420Test { | ||
|
||
@Test | ||
public void shouldHaveRegistry() { | ||
KubernetesList list = Serialization | ||
.unmarshalAsList(Issue420Test.class.getClassLoader().getResourceAsStream("META-INF/dekorate/kubernetes.yml")); | ||
assertNotNull(list); | ||
Deployment d = findFirst(list, Deployment.class).orElseThrow(() -> new IllegalStateException()); | ||
assertNotNull(d); | ||
Container c = d.getSpec().getTemplate().getSpec().getContainers().get(0); | ||
assertNotNull(c); | ||
String image = c.getImage(); | ||
assertTrue(image.startsWith("localhost:3000")); | ||
} | ||
|
||
<T extends HasMetadata> Optional<T> findFirst(KubernetesList list, Class<T> t) { | ||
return (Optional<T>) list.getItems().stream() | ||
.filter(i -> t.isInstance(i)) | ||
.findFirst(); | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
tests/issue-1000-docker-registry-docker-file-needs-Dockerfile/verify.groovy
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,8 @@ | ||
import io.dekorate.utils.Serialization | ||
import io.fabric8.kubernetes.api.model.KubernetesList | ||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
|
||
//Check that file exits | ||
String base = basedir | ||
File kubernetesYml = new File(base, "target/classes/META-INF/dekorate/kubernetes.yml") | ||
assert !kubernetesYml.exists() |