🤬
  • Fix RemotePluginImplTest not registering run service and extend PluginServiceClientTest deadline.

    PiperOrigin-RevId: 461068618
    Change-Id: I9278e7063edb79a20937bff32596b7206f43e7dc
  • Loading...
  • John Y. Kim committed with Copybara-Service 2 years ago
    a9dcf241
    1 parent 9fc53070
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■
    plugin/src/test/java/com/google/tsunami/plugin/PluginServiceClientTest.java
    skipped 63 lines
    64 64   private static final String PLUGIN_DESCRIPTION = "test description";
    65 65   private static final String PLUGIN_AUTHOR = "tester";
    66 66   
    67  - private static final Deadline DEADLINE_DEFAULT = Deadline.after(1, SECONDS);
     67 + private static final Deadline DEADLINE_DEFAULT = Deadline.after(5, SECONDS);
    68 68   
    69 69   private PluginServiceClient pluginService;
    70 70   private final MutableHandlerRegistry serviceRegistry = new MutableHandlerRegistry();
    skipped 247 lines
  • ■ ■ ■ ■ ■ ■
    plugin/src/test/java/com/google/tsunami/plugin/RemoteVulnDetectorImplTest.java
    skipped 82 lines
    83 83   @Test
    84 84   public void detect_withServingServer_returnsSuccessfulDetectionReportList() throws Exception {
    85 85   registerHealthCheckWithStatus(ServingStatus.SERVING);
     86 + registerSuccessfulRunService();
    86 87   
    87 88   RemoteVulnDetector pluginToTest = getNewRemoteVulnDetectorInstance();
    88 89   var endpointToTest = NetworkEndpointUtils.forIpAndPort("1.1.1.1", 80);
    skipped 125 lines
    214 215   public void check(
    215 216   HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) {
    216 217   responseObserver.onNext(HealthCheckResponse.newBuilder().setStatus(status).build());
     218 + responseObserver.onCompleted();
     219 + }
     220 + });
     221 + }
     222 + 
     223 + private void registerSuccessfulRunService() {
     224 + serviceRegistry.addService(
     225 + new PluginServiceImplBase() {
     226 + @Override
     227 + public void run(RunRequest request, StreamObserver<RunResponse> responseObserver) {
     228 + DetectionReportList.Builder reportListBuilder = DetectionReportList.newBuilder();
     229 + for (MatchedPlugin plugin : request.getPluginsList()) {
     230 + reportListBuilder.addDetectionReports(
     231 + DetectionReport.newBuilder()
     232 + .setTargetInfo(request.getTarget())
     233 + .setNetworkService(plugin.getServices(0)));
     234 + }
     235 + responseObserver.onNext(RunResponse.newBuilder().setReports(reportListBuilder).build());
    217 236   responseObserver.onCompleted();
    218 237   }
    219 238   });
    skipped 15 lines
Please wait...
Page is in error, reload to recover