File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,22 @@ func TestLastRefreshTime(t *testing.T) {
249249 t .Errorf ("signInWithPassword failed: %v" , err )
250250 }
251251
252- getUsersResult , err := client .GetUser (context .Background (), userRecord .UID )
253- if err != nil {
254- t .Fatalf ("GetUser(...) failed with error: %v" , err )
252+ // Attempt to retrieve the user 3 times (with a small delay between each attempt.) Occasionally,
253+ // this call retrieves the user data without the lastLoginTime/lastRefreshTime fields; possibly
254+ // because it's hitting a different server than what the login request used.
255+ var getUsersResult * auth.UserRecord
256+ for i := 0 ; i < 3 ; i ++ {
257+ var err error
258+ getUsersResult , err = client .GetUser (context .Background (), userRecord .UID )
259+ if err != nil {
260+ t .Fatalf ("GetUser(...) failed with error: %v" , err )
261+ }
262+
263+ if getUsersResult .UserMetadata .LastRefreshTimestamp != 0 {
264+ break
265+ }
266+
267+ time .Sleep (time .Second * time .Duration (2 ^ i ))
255268 }
256269
257270 // Ensure last refresh time is approx now (with tollerance of 10m)
You can’t perform that action at this time.
0 commit comments