fix(auth): Ensuring test user account cleanup with a Rule - #409
Conversation
micahstairs
left a comment
There was a problem hiding this comment.
Looks good! This is much better than try blocks.
| auth = FirebaseAuth.getInstance(masterApp); | ||
| } | ||
| @Rule | ||
| public final TemporaryUser temporaryUser = new TemporaryUser(); |
There was a problem hiding this comment.
Are you planning on adding a similar rule for tenants or should I take care of that?
There was a problem hiding this comment.
I might as well do it so that we don't step on each others' toes. I'm also planning on doing this for the provider configs.
There was a problem hiding this comment.
I didn't find that many instances where we create and delete provider configs. But if that's something we do repeatedly, then might be useful to make a similar change.
There was a problem hiding this comment.
It's not only a matter of reducing how many times we repeat the setup/cleanup. As it currently stands, if an assertion fails right after creating the provider config, it hasn't entered the "try" block yet, so the "finally" won't be executed. So we would either need to extend the try block back further, or we can use temporary provider configs. The temporary objects are nice because it is less of a burden on the developer writing integration tests, and it reduces the required nesting.
* fix(auth): Ensuring test user account cleanup with a Rule * Updated copyright holder
Using a JUnit
@Ruleto ensure that temporary user accounts are cleaned up in integration tests. This helps us avoid large try-finally blocks in tests.I also moved couple of new tenant management tests to a new
TenantManagerITclass.