Skip to content

Commit

Permalink
Fix up bazel-buildfarm to pass all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chenj-hub committed Aug 15, 2024
1 parent d6c1859 commit 9938118
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import build.buildfarm.cas.ContentAddressableStorage;
import build.buildfarm.cas.cfc.CASFileCache;
import build.buildfarm.common.BuildfarmExecutors;
import build.buildfarm.common.DigestUtil;
import build.buildfarm.common.io.Directories;
import build.buildfarm.common.io.Dirent;
import build.buildfarm.worker.ExecDirException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ private void insertFileToCasMember(Digest digest, DigestFunction.Value digestFun
}
}

private long writeToCasMember(Digest digest, InputStream in)
throws IOException, InterruptedException {
private long writeToCasMember(Digest digest, DigestFunction.Value digestFunction, InputStream in)
throws IOException, InterruptedException {
// create a write for inserting into another CAS member.
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/build/buildfarm/worker/shard/Worker.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@
import javax.annotation.Nullable;
import javax.naming.ConfigurationException;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@Log
public final class Worker extends LoggingMain {
Expand Down Expand Up @@ -146,7 +141,6 @@ public final class Worker extends LoggingMain {
private LoadingCache<String, Instance> workerStubs;
private AtomicBoolean released = new AtomicBoolean(true);

@Autowired private ApplicationContext springContext;
/**
* The method will prepare the worker for graceful shutdown when the worker is ready. Note on
* using stderr here instead of log. By the time this is called in PreDestroy, the log is no
Expand Down Expand Up @@ -227,10 +221,9 @@ public void run() {

// Consider defining exit codes to better afford out of band instance
// recovery
int code = SpringApplication.exit(springContext, () -> 1);
termFuture.cancel(false);
shutdownDeadlineExecutor.shutdown();
System.exit(code);
System.exit(0);
}

private Operation stripOperation(Operation operation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void noErrorWhenContextCancelled() throws Exception {
when(instance.getBlobWrite(
eq(Compressor.Value.IDENTITY),
eq(cancelledDigest),
eq(DigestFunction.Value.UNKNOWN),
eq(uuid),
any(RequestMetadata.class)))
.thenReturn(write);
Expand All @@ -137,6 +138,7 @@ public void noErrorWhenContextCancelled() throws Exception {
.getBlobWrite(
eq(Compressor.Value.IDENTITY),
eq(cancelledDigest),
eq(DigestFunction.Value.UNKNOWN),
eq(uuid),
any(RequestMetadata.class));
verifyNoInteractions(responseObserver);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/build/buildfarm/worker/PipelineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void stageExitsOnInterrupt() throws InterruptedException {
Pipeline pipeline = new Pipeline();
TestStage stage = new TestStage("test");
pipeline.add(stage, 1);
pipeline.start();
pipeline.start(null);
pipeline.join();
}

Expand Down Expand Up @@ -147,7 +147,7 @@ public void stageContinuesOnException() throws InterruptedException {
Pipeline pipeline = new Pipeline();
ContinueStage stage = new ContinueStage("test");
pipeline.add(stage, 1);
pipeline.start();
pipeline.start(null);

boolean didNotThrow = false;
try {
Expand Down

0 comments on commit 9938118

Please sign in to comment.