File tree 1 file changed +18
-0
lines changed
google-cloud-logging/src/test/java/com/google/cloud/logging/it
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 31
31
import com .google .cloud .logging .Sink ;
32
32
import com .google .cloud .logging .SinkInfo ;
33
33
import com .google .common .collect .Sets ;
34
+ import java .util .Iterator ;
34
35
import java .util .Set ;
36
+ import org .junit .BeforeClass ;
35
37
import org .junit .Test ;
36
38
37
39
public class ITSinkTest extends BaseSystemTest {
38
40
41
+ @ BeforeClass
42
+ public static void setUp () {
43
+ // Cleanup all stucked sinks if any
44
+ Logging .ListOption [] options = {Logging .ListOption .pageSize (50 )};
45
+ Page <Sink > sinkPage = logging .listSinks (options );
46
+ Iterator <Sink > iterator = sinkPage .iterateAll ().iterator ();
47
+ while (iterator .hasNext ()) {
48
+ Sink sink = iterator .next ();
49
+ try {
50
+ sink .delete ();
51
+ } catch (Exception ex ) {
52
+ System .err .println ("ERROR: Failed to delete a " + sink .getName () + " sink, error: " + ex );
53
+ }
54
+ }
55
+ }
56
+
39
57
@ Test
40
58
public void testCreateGetUpdateAndDeleteSink () {
41
59
String name = formatForTest ("test-create-get-update-sink" );
You can’t perform that action at this time.
0 commit comments