Skip to content

Commit

Permalink
enable auto-update
Browse files Browse the repository at this point in the history
  • Loading branch information
piomin committed Jan 22, 2023
1 parent 83172de commit 8b5decb
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 33 deletions.
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 2.1

jobs:
analyze:
docker:
- image: 'cimg/openjdk:17.0'
steps:
- checkout
- run:
name: Analyze on SonarCloud
command: mvn verify sonar:sonar -DskipTests

orbs:
maven: circleci/[email protected]
tcc: atomicjar/[email protected]

executors:
j17:
docker:
- image: 'cimg/openjdk:17.0'

workflows:
maven_test:
jobs:
- maven/test:
executor: j17
context: Testcontainers
pre-steps:
- tcc/setup
- analyze:
context: SonarCloud
19 changes: 19 additions & 0 deletions admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
19 changes: 19 additions & 0 deletions department-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,25 @@
</from>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
25 changes: 19 additions & 6 deletions employee-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-server-mock</artifactId>
<version>4.10.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -96,6 +90,25 @@
</from>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,21 @@
package pl.piomin.services.employee;

import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import pl.piomin.services.employee.model.Employee;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EnableKubernetesMockClient(crud = true)
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
class EmployeeAPITest {

static KubernetesClient client;

@Autowired
TestRestTemplate restTemplate;

@BeforeAll
static void init() {
System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY,
client.getConfiguration().getMasterUrl());
System.setProperty(Config.KUBERNETES_TRUST_CERT_SYSTEM_PROPERTY,
"true");
System.setProperty(
Config.KUBERNETES_AUTH_TRYKUBECONFIG_SYSTEM_PROPERTY, "false");
System.setProperty(
Config.KUBERNETES_AUTH_TRYSERVICEACCOUNT_SYSTEM_PROPERTY, "false");
System.setProperty(Config.KUBERNETES_HTTP2_DISABLE, "true");
System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY,
"default");
client.configMaps().inNamespace("default").createNew()
.withNewMetadata().withName("employee").endMetadata()
.addToData("application.properties",
"spring.data.mongodb.uri=mongodb://localhost:27017/test")
.done();
}

@Test
void addEmployeeTest() {
Employee employee = new Employee("1", "1", "Test", 30, "test");
Expand Down
20 changes: 20 additions & 0 deletions gateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.5</version>
<relativePath />
</parent>
<artifactId>gateway-service</artifactId>
<groupId>pl.piomin.services</groupId>
Expand Down Expand Up @@ -70,6 +71,25 @@
</from>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
19 changes: 19 additions & 0 deletions organization-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@
</from>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<version>1.1</version>
<packaging>pom</packaging>

<properties>
<sonar.projectKey>piomin_spring-microservices-kubernetes</sonar.projectKey>
<sonar.organization>piomin</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<modules>
<module>admin-service</module>
<module>employee-service</module>
Expand Down
13 changes: 13 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",":dependencyDashboard"
],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
],
"prCreation": "not-pending"
}

0 comments on commit 8b5decb

Please sign in to comment.