Skip to content

Commit

Permalink
Merge pull request #2000 from brendandburns/build-matrix
Browse files Browse the repository at this point in the history
Add Windows to our build matrix.
  • Loading branch information
k8s-ci-robot authored Nov 25, 2021
2 parents 0642e7b + cadf986 commit 73ae39a
Show file tree
Hide file tree
Showing 24 changed files with 241 additions and 82 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ jobs:
- name: Verify Format and License
run: mvn spotless:check
build:
runs-on: ubuntu-latest
name: Java ${{ matrix.java }} Maven Test
strategy:
matrix:
# Test against the LTS Java versions. TODO: add JDK18 when it becomes available.
java: [ 8.0.x, 11.0.x, 17.0.x ]
os: [ windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.4.0
- name: Setup Java
Expand All @@ -41,11 +42,9 @@ jobs:
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ matrix.java }}-${{ hashFiles('pom.xml', '**/pom.xml') }}
- name: Buid with Maven
- name: Build with Maven
run: |
sudo mvn clean test \
-q \
-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
mvn clean test -q -B --define=org.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
build-graalvm:
runs-on: ubuntu-latest
name: GraalVM Maven Test
Expand Down
61 changes: 48 additions & 13 deletions extended/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,54 @@
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} -Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<perCoreThreadCount>false</perCoreThreadCount>
<threadCount>1</threadCount>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>surefire-newerJava</id>
<activation>
<jdk>(1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{argLine} -Xms512m -Xmx1500m --illegal-access=warn --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED
</argLine>
<parallel>methods</parallel>
<perCoreThreadCount>false</perCoreThreadCount>
<threadCount>1</threadCount>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>surefire-java8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} -Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<perCoreThreadCount>false</perCoreThreadCount>
<threadCount>1</threadCount>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

/** The default delaying queue implementation. */
public class DefaultDelayingQueue<T> extends DefaultWorkQueue<T> implements DelayingQueue<T> {
Expand All @@ -34,8 +35,10 @@ public class DefaultDelayingQueue<T> extends DefaultWorkQueue<T> implements Dela
private DelayQueue<WaitForEntry<T>> delayQueue;
private ConcurrentMap<T, WaitForEntry<T>> waitingEntryByData;
protected BlockingQueue<WaitForEntry<T>> waitingForAddQueue;
private Supplier<Instant> timeSource;

public DefaultDelayingQueue(ExecutorService waitingWorker) {
this.timeSource = Instant::now;
this.delayQueue = new DelayQueue<>();
this.waitingEntryByData = new ConcurrentHashMap<>();
this.waitingForAddQueue = new LinkedBlockingQueue<>(1000);
Expand All @@ -57,10 +60,16 @@ public void addAfter(T item, Duration duration) {
super.add(item);
return;
}
WaitForEntry<T> entry = new WaitForEntry<>(item, duration.addTo(Instant.now()));
WaitForEntry<T> entry =
new WaitForEntry<>(item, duration.addTo(this.timeSource.get()), this.timeSource);
this.waitingForAddQueue.offer(entry);
}

// Visible for testing
protected void injectTimeSource(Supplier<Instant> fn) {
this.timeSource = fn;
}

private void waitingLoop() {
try {
while (true) {
Expand All @@ -78,7 +87,7 @@ private void waitingLoop() {
// a. if ready, remove it from the delay-queue and push it into underlying
// work-queue
// b. if not, refresh the next ready-at time.
Instant now = Instant.now();
Instant now = this.timeSource.get();
if (!Duration.between(entry.readyAtMillis, now).isNegative()) {
delayQueue.remove(entry);
super.add(entry.data);
Expand All @@ -92,7 +101,7 @@ private void waitingLoop() {
WaitForEntry<T> waitForEntry =
waitingForAddQueue.poll(nextReadyAt.toMillis(), TimeUnit.MILLISECONDS);
if (waitForEntry != null) {
if (Duration.between(waitForEntry.readyAtMillis, Instant.now()).isNegative()) {
if (Duration.between(waitForEntry.readyAtMillis, this.timeSource.get()).isNegative()) {
// the item is not yet ready, insert it to the delay-queue
insert(this.delayQueue, this.waitingEntryByData, waitForEntry);
} else {
Expand Down Expand Up @@ -126,17 +135,19 @@ private void insert(
// WaitForEntry holds the data to add and the time it should be added.
private static class WaitForEntry<T> implements Delayed {

private WaitForEntry(T data, Temporal readyAtMillis) {
private WaitForEntry(T data, Temporal readyAtMillis, Supplier<Instant> timeSource) {
this.data = data;
this.readyAtMillis = readyAtMillis;
this.timeSource = timeSource;
}

private T data;
private Temporal readyAtMillis;
private Supplier<Instant> timeSource;

@Override
public long getDelay(TimeUnit unit) {
Duration duration = Duration.between(Instant.now(), readyAtMillis);
Duration duration = Duration.between(this.timeSource.get(), readyAtMillis);
return unit.convert(duration.toMillis(), TimeUnit.MILLISECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,22 @@
public class KubectlApplyTest {

private static final String DISCOVERY_API =
KubectlApplyTest.class.getClassLoader().getResource("discovery-api.json").getPath();
new java.io.File(
KubectlApplyTest.class.getClassLoader().getResource("discovery-api.json").getPath())
.toString();

private static final String DISCOVERY_APIV1 =
KubectlApplyTest.class.getClassLoader().getResource("discovery-api-v1.json").getPath();
new java.io.File(
KubectlApplyTest.class
.getClassLoader()
.getResource("discovery-api-v1.json")
.getPath())
.toString();

private static final String DISCOVERY_APIS =
KubectlApplyTest.class.getClassLoader().getResource("discovery-apis.json").getPath();
new java.io.File(
KubectlApplyTest.class.getClassLoader().getResource("discovery-apis.json").getPath())
.toString();

private ApiClient apiClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import io.kubernetes.client.util.ClientBuilder;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -32,13 +33,21 @@
public class KubectlCreateTest {

private static final String DISCOVERY_API =
KubectlCreateTest.class.getClassLoader().getResource("discovery-api.json").getPath();
new File(KubectlCreateTest.class.getClassLoader().getResource("discovery-api.json").getPath())
.toString();

private static final String DISCOVERY_APIV1 =
KubectlCreateTest.class.getClassLoader().getResource("discovery-api-v1.json").getPath();
new File(
KubectlCreateTest.class
.getClassLoader()
.getResource("discovery-api-v1.json")
.getPath())
.toString();

private static final String DISCOVERY_APIS =
KubectlCreateTest.class.getClassLoader().getResource("discovery-apis.json").getPath();
new File(
KubectlCreateTest.class.getClassLoader().getResource("discovery-apis.json").getPath())
.toString();

private ApiClient apiClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.kubernetes.client.openapi.models.V1Pod;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.ModelMapper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -41,7 +42,8 @@
public class KubectlDrainTest {

private static final String POD_LIST_API =
KubectlDrainTest.class.getClassLoader().getResource("pod-list.json").getPath();
new File(KubectlDrainTest.class.getClassLoader().getResource("pod-list.json").getPath())
.toString();

private ApiClient apiClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.util.ClientBuilder;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -37,13 +38,20 @@
public class KubectlPatchTest {

private static final String DISCOVERY_API =
KubectlPatchTest.class.getClassLoader().getResource("discovery-api.json").getPath();
new File(KubectlPatchTest.class.getClassLoader().getResource("discovery-api.json").getPath())
.toString();

private static final String DISCOVERY_APIV1 =
KubectlPatchTest.class.getClassLoader().getResource("discovery-api-v1.json").getPath();
new File(
KubectlPatchTest.class
.getClassLoader()
.getResource("discovery-api-v1.json")
.getPath())
.toString();

private static final String DISCOVERY_APIS =
KubectlPatchTest.class.getClassLoader().getResource("discovery-apis.json").getPath();
new File(KubectlPatchTest.class.getClassLoader().getResource("discovery-apis.json").getPath())
.toString();

private ApiClient apiClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.kubernetes.client.openapi.models.V1StatefulSetList;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.ModelMapper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -50,34 +51,56 @@ public class KubectlRolloutTest {
@Rule public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());

private static final String DEPLOYMENT =
KubectlRolloutTest.class.getClassLoader().getResource("deployment.json").getPath();
new File(KubectlRolloutTest.class.getClassLoader().getResource("deployment.json").getPath())
.toString();

private static final String REPLICASET_LIST =
KubectlRolloutTest.class.getClassLoader().getResource("replicaset-list.json").getPath();
new File(
KubectlRolloutTest.class
.getClassLoader()
.getResource("replicaset-list.json")
.getPath())
.toString();

private static final String DAEMON_SET =
KubectlRolloutTest.class.getClassLoader().getResource("daemonset.json").getPath();
new File(KubectlRolloutTest.class.getClassLoader().getResource("daemonset.json").getPath())
.toString();

private static final String PATCHED_DAEMON_SET =
KubectlRolloutTest.class.getClassLoader().getResource("patched-daemonset.json").getPath();
new File(
KubectlRolloutTest.class
.getClassLoader()
.getResource("patched-daemonset.json")
.getPath())
.toString();

private static final String DAEMON_SET_CONTROLLER_REVISION_LIST =
KubectlRolloutTest.class
.getClassLoader()
.getResource("daemonset-controllerrevision-list.json")
.getPath();
new File(
KubectlRolloutTest.class
.getClassLoader()
.getResource("daemonset-controllerrevision-list.json")
.getPath())
.toString();

private static final String STATEFUL_SET =
KubectlRolloutTest.class.getClassLoader().getResource("statefulset.json").getPath();
new File(KubectlRolloutTest.class.getClassLoader().getResource("statefulset.json").getPath())
.toString();

private static final String PATCHED_STATEFUL_SET =
KubectlRolloutTest.class.getClassLoader().getResource("patched-statefulset.json").getPath();
new File(
KubectlRolloutTest.class
.getClassLoader()
.getResource("patched-statefulset.json")
.getPath())
.toString();

private static final String STATEFUL_SET_CONTROLLER_REVISION_LIST =
KubectlRolloutTest.class
.getClassLoader()
.getResource("statefulset-controllerrevision-list.json")
.getPath();
new File(
KubectlRolloutTest.class
.getClassLoader()
.getResource("statefulset-controllerrevision-list.json")
.getPath())
.toString();

@Before
public void setup() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.kubernetes.client.openapi.models.V1ReplicaSet;
import io.kubernetes.client.openapi.models.V1ReplicaSetList;
import io.kubernetes.client.util.ClientBuilder;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -46,10 +47,16 @@ public class DeploymentHelperTest {
@Rule public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort(), false);

private static final String DEPLOYMENT =
DeploymentHelperTest.class.getClassLoader().getResource("deployment.json").getPath();
new File(DeploymentHelperTest.class.getClassLoader().getResource("deployment.json").getPath())
.toString();

private static final String REPLICASET_LIST =
DeploymentHelperTest.class.getClassLoader().getResource("replicaset-list.json").getPath();
new File(
DeploymentHelperTest.class
.getClassLoader()
.getResource("replicaset-list.json")
.getPath())
.toString();

@Before
public void setup() throws IOException {
Expand Down
Loading

0 comments on commit 73ae39a

Please sign in to comment.