@@ -509,6 +509,17 @@ func TestDeleteUser(t *testing.T) {
509
509
}
510
510
511
511
func TestDeleteUsers (t * testing.T ) {
512
+ // Deletes users slowly. There's currently a 1qps limitation on this API.
513
+ // Without this helper, the integration tests occasionally hit that limit
514
+ // and fail.
515
+ //
516
+ // TODO(rsgowman): Remove this function when/if the 1qps limitation is
517
+ // relaxed.
518
+ slowDeleteUsers := func (ctx context.Context , uids []string ) (* auth.DeleteUsersResult , error ) {
519
+ time .Sleep (1 * time .Second )
520
+ return client .DeleteUsers (ctx , uids )
521
+ }
522
+
512
523
// Ensures the specified users don't exist. Expected to be called after
513
524
// deleting the users to ensure the delete method worked.
514
525
ensureUsersNotFound := func (t * testing.T , uids []string ) {
@@ -546,7 +557,7 @@ func TestDeleteUsers(t *testing.T) {
546
557
newUserWithParams (t ).UID , newUserWithParams (t ).UID , newUserWithParams (t ).UID ,
547
558
}
548
559
549
- result , err := client . DeleteUsers (context .Background (), uids )
560
+ result , err := slowDeleteUsers (context .Background (), uids )
550
561
if err != nil {
551
562
t .Fatalf ("DeleteUsers([valid_ids]) error %v; want nil" , err )
552
563
}
@@ -566,7 +577,7 @@ func TestDeleteUsers(t *testing.T) {
566
577
567
578
t .Run ("deletes users that exist even when non-existing users also specified" , func (t * testing.T ) {
568
579
uids := []string {newUserWithParams (t ).UID , "uid-that-doesnt-exist" }
569
- result , err := client . DeleteUsers (context .Background (), uids )
580
+ result , err := slowDeleteUsers (context .Background (), uids )
570
581
if err != nil {
571
582
t .Fatalf ("DeleteUsers(uids) error %v; want nil" , err )
572
583
}
@@ -586,7 +597,7 @@ func TestDeleteUsers(t *testing.T) {
586
597
587
598
t .Run ("is idempotent" , func (t * testing.T ) {
588
599
deleteUserAndEnsureSuccess := func (t * testing.T , uids []string ) {
589
- result , err := client . DeleteUsers (context .Background (), uids )
600
+ result , err := slowDeleteUsers (context .Background (), uids )
590
601
if err != nil {
591
602
t .Fatalf ("DeleteUsers(uids) error %v; want nil" , err )
592
603
}
0 commit comments