Skip to content
Open

3.0.3 #288

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f509169
noop.
cmeiklejohn Nov 12, 2023
6ced28b
Disable docker integration.
cmeiklejohn Nov 12, 2023
ca3c94f
Disable python integration tests.
cmeiklejohn Nov 12, 2023
b919bac
Remove jacoco (since it isn't working anyway.)
cmeiklejohn Nov 12, 2023
8837457
Move WorldTest to another directory to determine if it's flaky based …
cmeiklejohn Nov 12, 2023
5dbf2bf
Remove unused variables.
cmeiklejohn Nov 12, 2023
3fe5f03
Prevent 400 Bad Request by sending required header.
cmeiklejohn Nov 12, 2023
f56e081
Make test resilient to thread scheduling anomalies.
cmeiklejohn Nov 12, 2023
8b106d3
Switch to Gradle 8.4.
cmeiklejohn Nov 12, 2023
38ff350
Add shadow jar plugin.
cmeiklejohn Nov 12, 2023
72605fe
Remove errorprone.
cmeiklejohn Nov 12, 2023
7c319bc
Add dummy main class.
cmeiklejohn Nov 12, 2023
e02cf9f
Remove locking.
cmeiklejohn Nov 12, 2023
51c96e7
Add java library.
cmeiklejohn Nov 12, 2023
45e05a2
Make private constructor.
cmeiklejohn Nov 12, 2023
487b6b7
Set main class name.
cmeiklejohn Nov 12, 2023
749c6b1
Setup jar manifest.
cmeiklejohn Nov 12, 2023
750b945
Add standalone publishing publication.
cmeiklejohn Nov 12, 2023
d0fb4fa
Add shadowJar configuration.
cmeiklejohn Nov 12, 2023
c9a0fc0
Update jar build configuration.
cmeiklejohn Nov 12, 2023
2ff719b
Bump to 3.0.0.
cmeiklejohn Nov 12, 2023
3b8b90c
Switch to API configuration.
cmeiklejohn Nov 12, 2023
7ddea46
Update build task to publish standalone jar.
cmeiklejohn Nov 12, 2023
b2c4954
Relocate only netty and jetty.
cmeiklejohn Nov 12, 2023
a57f8b0
noop
cmeiklejohn Nov 12, 2023
8565bd2
Add short-circuit for the local backend.
cmeiklejohn Nov 12, 2023
20a259b
Avoid starts for the local server.
cmeiklejohn Nov 12, 2023
f66347f
No longer start the local server HTTP server.
cmeiklejohn Nov 12, 2023
24a7295
Remove property with no setter.
cmeiklejohn Nov 12, 2023
3d6e928
bump to 3.0.2
cmeiklejohn Nov 12, 2023
53d2689
Revert "Disable docker integration."
cmeiklejohn Nov 12, 2023
e1afb39
Revert "Disable python integration tests."
cmeiklejohn Nov 12, 2023
d0bb7cc
Refactor python tests.
cmeiklejohn Nov 12, 2023
4bf4bb5
Change number of expected assertions.
cmeiklejohn Nov 12, 2023
2a64ce9
Fix number of expected tests.
cmeiklejohn Nov 12, 2023
2028b2d
Minor.
cmeiklejohn Nov 12, 2023
536805e
Bump version of Armeria
cmeiklejohn Nov 13, 2023
406d93f
Merge remote-tracking branch 'origin/main' into csm/improvements
cmeiklejohn Jan 31, 2024
91c57c5
Remove shadowjar construction.
cmeiklejohn Jan 31, 2024
0f4f6cc
changelog.
cmeiklejohn Jan 31, 2024
7a07afd
Fix API/implementation.
cmeiklejohn Jan 31, 2024
20bb6ee
fix changelog.
cmeiklejohn Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.0.3:
- (cmeiklejohn) Remove jacoco.
- (cmeiklejohn) Bump gradle.
- (cmeiklejohn) Remove support for Python backend, streamline Docker backend, switch Py tests to Docker.
- (cmeiklejohn) Address possibly flaky test.
- (cmeiklejohn) Bump armeria version.
3.0.2:
- (cmeiklejohn) Minor UX refactoring.
3.0.1:
Expand Down
29 changes: 5 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: 'jacoco'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'com.google.protobuf'

Expand All @@ -44,9 +43,8 @@ dependencies {
'armeria-thrift0.13',
'armeria-tomcat9',
'armeria-zookeeper3'].each {
implementation "com.linecorp.armeria:${it}:1.14.0"
implementation "com.linecorp.armeria:${it}:1.22.1"
}

implementation "io.lettuce:lettuce-core:6.2.2.RELEASE"
implementation 'org.postgresql:postgresql:42.3.3'
implementation 'com.datastax.cassandra:cassandra-driver-core:4.0.0'
Expand All @@ -59,47 +57,31 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.grpcmock:grpcmock-junit5:0.9.3'
implementation 'com.google.protobuf:protobuf-java-util:3.21.7'

// Pinned jetty for WireMock
implementation 'org.eclipse.jetty:jetty-http:9.4.46.v20220331'
implementation 'org.eclipse.jetty:jetty-io:9.4.46.v20220331'
implementation 'org.eclipse.jetty:jetty-server:9.4.46.v20220331'
implementation 'org.eclipse.jetty:jetty-util:9.4.46.v20220331'

// JUnit annotations
implementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'

// Test Containers
implementation "org.testcontainers:testcontainers:1.17.5"

// Excel
implementation "org.apache.poi:poi:5.2.0"
implementation "org.apache.poi:poi-ooxml:5.2.0"
implementation "org.jxls:jxls-jexcel:1.0.9"
implementation "org.dhatim:fastexcel:0.15.3"
implementation "org.dhatim:fastexcel-reader:0.15.3"

// Logging
runtimeOnly 'ch.qos.logback:logback-classic:1.2.3'
runtimeOnly 'org.slf4j:log4j-over-slf4j:1.7.30'

// Test dependencies are used for testing Filibuster. Any jUnit, etc. have to be main dependencies
// with the assumption that Filibuster is only pulled in as a test dependency in the application that
// uses it.
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'

testImplementation 'io.opentelemetry:opentelemetry-api:1.6.0'
testImplementation 'io.opentelemetry:opentelemetry-extension-annotations:1.6.0'

testImplementation 'io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.6.0-alpha'

testImplementation 'com.github.tomakehurst:wiremock-standalone:2.27.2'
testImplementation 'io.netty:netty-tcnative-boringssl-static:2.0.61.Final'
}

test {
useJUnitPlatform()
finalizedBy jacocoTestReport
maxParallelForks = 1
timeout = Duration.ofMinutes(60)
minHeapSize = "128m" // initial heap size
Expand All @@ -114,10 +96,6 @@ test {
}
}

jacocoTestReport {
dependsOn test
}

tasks.withType(JavaCompile) {
options.compilerArgs += '-parameters'
options.compilerArgs += '-Xlint:unchecked'
Expand Down Expand Up @@ -171,7 +149,7 @@ javadoc {

group = "cloud.filibuster"
archivesBaseName = "instrumentation"
version = "3.0.2"
version = "3.0.3"

java {
withJavadocJar()
Expand Down Expand Up @@ -341,3 +319,6 @@ task testWithFaultInjectionDocker(type: Test) {
includeTestsMatching('cloud.filibuster.functional.docker.*')
}
}

project.setProperty("mainClassName", "cloud.filibuster.instrumentation.Main")

277 changes: 0 additions & 277 deletions gradle.lockfile

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions src/main/java/cloud/filibuster/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package cloud.filibuster;

public class Main {
private Main() {

}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package cloud.filibuster.instrumentation.instrumentors;

import cloud.filibuster.exceptions.filibuster.FilibusterRuntimeException;
import cloud.filibuster.instrumentation.datatypes.FilibusterExecutor;
import cloud.filibuster.instrumentation.datatypes.VectorClock;
import cloud.filibuster.instrumentation.helpers.Networking;
import cloud.filibuster.instrumentation.helpers.Response;
import cloud.filibuster.instrumentation.storage.ContextStorage;
import cloud.filibuster.exceptions.filibuster.FilibusterServerBadResponseException;
import cloud.filibuster.junit.server.core.FilibusterCore;
import com.linecorp.armeria.client.WebClient;
import com.linecorp.armeria.common.AggregatedHttpResponse;
import com.linecorp.armeria.common.HttpHeaderNames;
Expand All @@ -24,6 +26,7 @@
import static cloud.filibuster.instrumentation.helpers.Counterexample.canLoadCounterexample;
import static cloud.filibuster.instrumentation.helpers.Counterexample.loadCounterexampleAsJsonObjectFromEnvironment;
import static cloud.filibuster.instrumentation.helpers.Counterexample.loadTestExecutionFromCounterexample;
import static cloud.filibuster.instrumentation.helpers.Property.getServerBackendCanInvokeDirectlyProperty;

/**
* Server instrumentor for Filibuster.
Expand Down Expand Up @@ -139,65 +142,75 @@ public void beforeInvocation() {
logger.log(Level.INFO, "beforeInvocation [server]: about to make call.");

if (getDistributedExecutionIndex() != null) {
JSONObject payload = new JSONObject();
payload.put("instrumentation_type", "request_received");
payload.put("generated_id", getGeneratedId());
payload.put("target_service_name", serviceName);
payload.put("execution_index", getDistributedExecutionIndex());
JSONObject requestReceivedPayload = new JSONObject();
requestReceivedPayload.put("instrumentation_type", "request_received");
requestReceivedPayload.put("generated_id", getGeneratedId());
requestReceivedPayload.put("target_service_name", serviceName);
requestReceivedPayload.put("execution_index", getDistributedExecutionIndex());

logger.log(Level.INFO, "payload: " + payload);
logger.log(Level.INFO, "requestReceivedPayload: " + requestReceivedPayload);

if (shouldCommunicateWithServer && counterexampleNotProvided()) {
CompletableFuture<String> updateFuture = CompletableFuture.supplyAsync(() -> {
String uri = "http://" + Networking.getFilibusterHost() + ":" + Networking.getFilibusterPort() + "/";
logger.log(Level.INFO, "making call to filibuster server, update with body: " + payload);
logger.log(Level.INFO, "URI: " + uri);
WebClient webClient = FilibusterExecutor.getWebClient("http://" + Networking.getFilibusterHost() + ":" + Networking.getFilibusterPort() + "/");

RequestHeaders postJson = RequestHeaders.of(
HttpMethod.POST,
"/filibuster/update",
HttpHeaderNames.CONTENT_TYPE,
"application/json",
"X-Filibuster-Instrumentation",
"true");
AggregatedHttpResponse response = webClient.execute(postJson, payload.toString()).aggregate().join();

ResponseHeaders headers = response.headers();
String statusCode = headers.get(HttpHeaderNames.STATUS);

if (statusCode == null) {
FilibusterServerBadResponseException.logAndThrow("beforeInvocation, statusCode: null");
if (getServerBackendCanInvokeDirectlyProperty()) {
if (FilibusterCore.hasCurrentInstance()) {
FilibusterCore.getCurrentInstance().endInvocation(requestReceivedPayload, false);
} else {
throw new FilibusterRuntimeException("No current filibuster core instance, this could indicate a problem.");
}

if (!Objects.equals(statusCode, "200")) {
FilibusterServerBadResponseException.logAndThrow("beforeInvocation, statusCode: " + statusCode);
}

JSONObject jsonObject = Response.aggregatedHttpResponseToJsonObject(response);

if (jsonObject.has("execution_index")) {
distributedExecutionIndex = jsonObject.getString("execution_index");
return distributedExecutionIndex;
} else {
CompletableFuture<String> updateFuture = CompletableFuture.supplyAsync(() -> {
String uri = "http://" + Networking.getFilibusterHost() + ":" + Networking.getFilibusterPort() + "/";
logger.log(Level.INFO, "making call to filibuster server, update with body: " + requestReceivedPayload);
logger.log(Level.INFO, "URI: " + uri);
WebClient webClient = FilibusterExecutor.getWebClient("http://" + Networking.getFilibusterHost() + ":" + Networking.getFilibusterPort() + "/");

RequestHeaders postJson = RequestHeaders.of(
HttpMethod.POST,
"/filibuster/update",
HttpHeaderNames.CONTENT_TYPE,
"application/json",
"X-Filibuster-Instrumentation",
"true",
"X-Filibuster-Is-Update",
String.valueOf(false));
AggregatedHttpResponse response = webClient.execute(postJson, requestReceivedPayload.toString()).aggregate().join();

ResponseHeaders headers = response.headers();
String statusCode = headers.get(HttpHeaderNames.STATUS);

if (statusCode == null) {
FilibusterServerBadResponseException.logAndThrow("beforeInvocation, statusCode: null");
}

if (!Objects.equals(statusCode, "200")) {
FilibusterServerBadResponseException.logAndThrow("beforeInvocation, statusCode: " + statusCode);
}

JSONObject jsonObject = Response.aggregatedHttpResponseToJsonObject(response);

if (jsonObject.has("execution_index")) {
distributedExecutionIndex = jsonObject.getString("execution_index");
return distributedExecutionIndex;
}

return null;
}, FilibusterExecutor.getExecutorService());

try {
String newDistributedExecutionIndex = updateFuture.get();

if (newDistributedExecutionIndex != null) {
logger.log(Level.INFO, "rewriting EI from: " + contextStorage.getDistributedExecutionIndex() + " to " + distributedExecutionIndex);
contextStorage.setDistributedExecutionIndex(distributedExecutionIndex);
}
} catch (InterruptedException | ExecutionException e) {
logger.log(Level.SEVERE, "cannot get information from Filibuster server: " + e);
}

return null;
}, FilibusterExecutor.getExecutorService());
logger.log(Level.INFO, "beforeInvocation [server]: finished.");

try {
String newDistributedExecutionIndex = updateFuture.get();

if (newDistributedExecutionIndex != null) {
logger.log(Level.INFO, "rewriting EI from: " + contextStorage.getDistributedExecutionIndex() + " to " + distributedExecutionIndex);
contextStorage.setDistributedExecutionIndex(distributedExecutionIndex);
}
} catch (InterruptedException | ExecutionException e) {
logger.log(Level.SEVERE, "cannot get information from Filibuster server: " + e);
logger.log(Level.INFO, "call complete.");
}

logger.log(Level.INFO, "beforeInvocation [server]: finished.");

logger.log(Level.INFO, "call complete.");
} else {
logger.log(Level.INFO, "skipping!");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package cloud.filibuster.junit.server;

import cloud.filibuster.exceptions.filibuster.FilibusterRuntimeException;
import cloud.filibuster.instrumentation.datatypes.FilibusterExecutor;
import cloud.filibuster.instrumentation.exceptions.FilibusterServerUnavailabilityException;
import cloud.filibuster.instrumentation.helpers.Networking;
import cloud.filibuster.junit.configuration.FilibusterConfiguration;
import cloud.filibuster.junit.server.backends.FilibusterLocalServerBackend;
import com.linecorp.armeria.client.WebClient;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -49,6 +51,16 @@ public static synchronized WebClient startServer(FilibusterConfiguration filibus
if (!started) {
FilibusterServerBackend filibusterServerBackend = filibusterConfiguration.getServerBackend();

if (filibusterServerBackend instanceof FilibusterLocalServerBackend) {
try {
filibusterServerBackend.start(filibusterConfiguration);
} catch (Throwable e) {
throw new FilibusterRuntimeException("we should never hit here, since the local server should always start.");
}

return getNewWebClient();
}

try {
filibusterServerBackend.start(filibusterConfiguration);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,19 @@
public class FilibusterLocalServerBackend implements FilibusterServerBackend {
private static final Logger logger = Logger.getLogger(FilibusterLocalServerBackend.class.getName());

@Nullable
private static Server filibusterServer;

@Override
public synchronized boolean start(FilibusterConfiguration filibusterConfiguration) throws InterruptedException {
// Even though the value of the new appears unused. It is necessary since this FilibusterCore
// object can be accessed via FilibusterCore.getCurrentInstance
new FilibusterCore(filibusterConfiguration);

if (filibusterServer == null) {
filibusterServer = FilibusterServer.serve();
}
if(filibusterServer == null)
{
throw new FilibusterServerNullException("The Filibuster Server should not be null at this point.");
}
filibusterServer.start();

setServerBackendCanInvokeDirectlyProperty(true);

return true;
}

@Override
public synchronized boolean stop(FilibusterConfiguration filibusterConfiguration) {
if (filibusterServer != null) {
filibusterServer.stop();
}

FilibusterCore.removeCurrentInstance();

// Poke the GC once we dereference the FilibusterCore object (via FilibusterServer.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class JUnitFilibusterDockerBackendTestCorrectImage extends JUnitBaseTest
* @throws InterruptedException if teardown of gRPC channel fails.
*/
@DisplayName("Test partial hello server grpc route with Filibuster. (MyHelloService, MyWorldService)")
@TestWithFilibuster(serverBackend = FilibusterDockerServerBackend.class)
@TestWithFilibuster(serverBackend=FilibusterDockerServerBackend.class)
@Order(1)
public void testMyHelloAndMyWorldServiceWithFilibuster() throws InterruptedException {
ManagedChannel helloChannel = ManagedChannelBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package cloud.filibuster.functional.python.armeria;
package cloud.filibuster.functional.docker.armeria;

import cloud.filibuster.RpcType;
import cloud.filibuster.examples.Hello;
import cloud.filibuster.examples.HelloServiceGrpc;
import cloud.filibuster.instrumentation.helpers.Networking;
import cloud.filibuster.junit.TestWithFilibuster;
import cloud.filibuster.junit.configuration.FilibusterAnalysisConfiguration;
import cloud.filibuster.junit.configuration.FilibusterCustomAnalysisConfigurationFile;
import cloud.filibuster.junit.interceptors.GitHubActionsSkipInvocationInterceptor;
import cloud.filibuster.junit.server.backends.FilibusterDockerServerBackend;
import cloud.filibuster.junit.server.backends.FilibusterLocalProcessServerBackend;
import cloud.filibuster.functional.JUnitBaseTest;
import io.grpc.ManagedChannel;
Expand Down Expand Up @@ -41,6 +43,7 @@ public static void writeCustomAnalysisFile() {
FilibusterAnalysisConfiguration filibusterAnalysisConfiguration = new FilibusterAnalysisConfiguration.Builder()
.name("java.grpc")
.pattern("(.*/.*)")
.rpcType(RpcType.GRPC)

// Base exceptions.
.exception("io.grpc.StatusRuntimeException", Map.of(
Expand Down Expand Up @@ -86,7 +89,7 @@ public static void writeCustomAnalysisFile() {
* @throws InterruptedException thrown if the gRPC channel fails to terminate.
*/
@DisplayName("Test partial hello server grpc route with Filibuster. (MyHelloService, MyWorldService)")
@TestWithFilibuster(analysisFile=analysisFilePath, serverBackend=FilibusterLocalProcessServerBackend.class)
@TestWithFilibuster(analysisFile=analysisFilePath, serverBackend=FilibusterDockerServerBackend.class)
@ExtendWith(GitHubActionsSkipInvocationInterceptor.class)
@Order(1)
public void testMyHelloAndMyWorldServiceWithFilibuster() throws InterruptedException {
Expand Down
Loading