@@ -1851,6 +1851,7 @@ public void testWriteLogEntries() {
18511851 .addAllEntries (
18521852 Iterables .transform (
18531853 ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), LogEntry .toPbFunction (PROJECT )))
1854+ .setPartialSuccess (true )
18541855 .build ();
18551856 WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
18561857 EasyMock .expect (loggingRpcMock .write (request )).andReturn (ApiFutures .immediateFuture (response ));
@@ -1869,6 +1870,7 @@ public void testWriteLogEntriesDoesNotEnableFlushByDefault() {
18691870 ImmutableList .of (
18701871 LOG_ENTRY1 , LOG_ENTRY2 .toBuilder ().setSeverity (Severity .EMERGENCY ).build ()),
18711872 LogEntry .toPbFunction (PROJECT )))
1873+ .setPartialSuccess (true )
18721874 .build ();
18731875 ApiFuture <WriteLogEntriesResponse > apiFuture = SettableApiFuture .create ();
18741876 EasyMock .expect (loggingRpcMock .write (request )).andReturn (apiFuture );
@@ -1886,6 +1888,7 @@ public void testWriteLogEntriesWithSeverityFlushEnabled() {
18861888 .addAllEntries (
18871889 Iterables .transform (
18881890 ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), LogEntry .toPbFunction (PROJECT )))
1891+ .setPartialSuccess (true )
18891892 .build ();
18901893 WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
18911894 EasyMock .expect (loggingRpcMock .write (request )).andReturn (ApiFutures .immediateFuture (response ));
@@ -1934,6 +1937,7 @@ public void testWriteLogEntriesAsync() {
19341937 ImmutableList .of (
19351938 LOG_ENTRY1 , LOG_ENTRY2 , LOG_ENTRY_NO_DESTINATION , LOG_ENTRY_EMPTY ),
19361939 LogEntry .toPbFunction (PROJECT )))
1940+ .setPartialSuccess (true )
19371941 .build ();
19381942 WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
19391943 EasyMock .expect (loggingRpcMock .write (request )).andReturn (ApiFutures .immediateFuture (response ));
@@ -1955,6 +1959,7 @@ public void testWriteLogEntriesAsyncWithOptions() {
19551959 .addAllEntries (
19561960 Iterables .transform (
19571961 ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), LogEntry .toPbFunction (PROJECT )))
1962+ .setPartialSuccess (true )
19581963 .build ();
19591964 WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
19601965 EasyMock .expect (loggingRpcMock .write (request )).andReturn (ApiFutures .immediateFuture (response ));
@@ -2229,6 +2234,7 @@ public void testFlush() throws InterruptedException {
22292234 .addAllEntries (
22302235 Iterables .transform (
22312236 ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), LogEntry .toPbFunction (PROJECT )))
2237+ .setPartialSuccess (true )
22322238 .build ();
22332239 EasyMock .expect (loggingRpcMock .write (request )).andReturn (mockRpcResponse );
22342240 EasyMock .replay (loggingRpcMock );
@@ -2264,6 +2270,7 @@ public void testFlushStress() throws InterruptedException {
22642270 WriteLogEntriesRequest .newBuilder ()
22652271 .addAllEntries (
22662272 Iterables .transform (ImmutableList .of (LOG_ENTRY1 ), LogEntry .toPbFunction (PROJECT )))
2273+ .setPartialSuccess (true )
22672274 .build ();
22682275
22692276 Thread [] threads = new Thread [100 ];
@@ -2304,6 +2311,22 @@ public void testDiagnosticInfoWithPartialSuccess() {
23042311 testDiagnosticInfoGeneration (true );
23052312 }
23062313
2314+ @ Test
2315+ public void testPartialSuccessNotOverridenIfPresent () {
2316+ WriteLogEntriesRequest request =
2317+ WriteLogEntriesRequest .newBuilder ()
2318+ .addAllEntries (
2319+ Iterables .transform (
2320+ ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), LogEntry .toPbFunction (PROJECT )))
2321+ .setPartialSuccess (false )
2322+ .build ();
2323+ WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
2324+ EasyMock .expect (loggingRpcMock .write (request )).andReturn (ApiFutures .immediateFuture (response ));
2325+ EasyMock .replay (rpcFactoryMock , loggingRpcMock );
2326+ logging = options .getService ();
2327+ logging .write (ImmutableList .of (LOG_ENTRY1 , LOG_ENTRY2 ), WriteOption .partialSuccess (false ));
2328+ }
2329+
23072330 private void testDiagnosticInfoGeneration (boolean addPartialSuccessOption ) {
23082331 Instrumentation .setInstrumentationStatus (false );
23092332 LogEntry jsonEntry =
@@ -2362,6 +2385,7 @@ private void testWriteLogEntriesWithDestination(
23622385 LOG_ENTRY_NO_DESTINATION ,
23632386 LOG_ENTRY_EMPTY ),
23642387 LogEntry .toPbFunction (projectId )))
2388+ .setPartialSuccess (true )
23652389 .build ();
23662390 WriteLogEntriesResponse response = WriteLogEntriesResponse .getDefaultInstance ();
23672391 EasyMock .expect (loggingRpcMock .write (expectedWriteLogEntriesRequest ))
0 commit comments