-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
135 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,23 +16,20 @@ on: | |
required: false | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'oracle' | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: Setup Gradle 5.6.4 | ||
uses: gradle/[email protected] | ||
- name: Setup Gradle 8.x | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
gradle-version: 5.6.4 | ||
gradle-version: "8.10.2" | ||
- name: Execute Gradle build | ||
run: ./gradlew clean build copyDependencies :server:copyJacocoAgent -x test | ||
- name: Build the Docker image | ||
|
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 |
---|---|---|
|
@@ -10,27 +10,23 @@ on: | |
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'oracle' | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: Setup Gradle 5.6.4 | ||
uses: gradle/[email protected] | ||
- name: Setup Gradle 8.x | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
gradle-version: 5.6.4 | ||
gradle-version: "8.10.2" | ||
- name: Execute Gradle build | ||
run: ./gradlew clean build copyDependencies :server:copyJacocoAgent -x test | ||
- name: Prepare mount directory for Web container - to write code coverage file. | ||
|
@@ -53,13 +49,12 @@ jobs: | |
uses: jwalton/gh-docker-logs@v2 | ||
with: | ||
images: 'varadhi.docker.registry/varadhi,apachepulsar/pulsar,zookeeper' | ||
|
||
- name: Restart the server process to force the code coverage dump | ||
run: docker exec server pkill java | ||
- name: Generate Code Coverage report | ||
run: ./gradlew jacocoTestReport | ||
- name: Publish code coverage (uses CodeCov.io) | ||
uses: codecov/codecov-action@v3 | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
files: | | ||
*/build/reports/jacoco/test/jacocoTestReport.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 |
---|---|---|
|
@@ -23,15 +23,15 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'oracle' | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: 'gradle' | ||
- name: Setup Gradle 5.6.4 | ||
uses: gradle/[email protected] | ||
- name: Setup Gradle 8.x | ||
uses: gradle/actions/setup-gradle@v4 | ||
with: | ||
gradle-version: 5.6.4 | ||
gradle-version: "8.10.2" | ||
- name: Execute Gradle build | ||
run: ./gradlew clean build |
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
18 changes: 12 additions & 6 deletions
18
common/src/main/java/com/flipkart/varadhi/utils/HostUtils.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 |
---|---|---|
@@ -1,18 +1,24 @@ | ||
package com.flipkart.varadhi.utils; | ||
|
||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
@Slf4j | ||
public class HostUtils { | ||
@Getter | ||
private static String hostName; | ||
@Getter | ||
private static String hostAddress; | ||
|
||
public static String getHostName() throws UnknownHostException { | ||
// debug to see how much time it takes, in case DNS resolution is taking time. | ||
log.debug("getHostName: started"); | ||
String host = InetAddress.getLocalHost().getHostName(); | ||
log.debug("getHostName: completed"); | ||
return host; | ||
public static void initHostUtils() throws UnknownHostException { | ||
if(hostName == null) { | ||
hostName = InetAddress.getLocalHost().getHostName(); | ||
} | ||
if(hostAddress == null) { | ||
hostAddress = InetAddress.getLocalHost().getHostAddress(); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
common/src/test/java/com/flipkart/varadhi/utils/HostUtilsTest.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 |
---|---|---|
@@ -1,18 +1,33 @@ | ||
package com.flipkart.varadhi.utils; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
||
public class HostUtilsTest { | ||
|
||
@BeforeAll | ||
public static void init() throws UnknownHostException { | ||
HostUtils.initHostUtils(); | ||
} | ||
|
||
@Test | ||
public void TestGetHostName() throws UnknownHostException { | ||
// dummy test.. no validations here. | ||
String host = HostUtils.getHostName(); | ||
Assertions.assertNotNull(host); | ||
Assertions.assertEquals(InetAddress.getLocalHost().getHostName(), host); | ||
} | ||
|
||
@Test | ||
public void TestGetHostAddress() throws UnknownHostException { | ||
// dummy test.. no validations here. | ||
String address = HostUtils.getHostAddress(); | ||
Assertions.assertNotNull(address); | ||
Assertions.assertEquals(InetAddress.getLocalHost().getHostAddress(), address); | ||
} | ||
|
||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
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.