Testing Singleton Resources
It’s quite common in Elixir and Erlang applications to have singleton resources. A singleton resource exists in your application as a single and unique unit. For example, a process with a globally registered name is a singleton resource, since no other process with that same name can exist in the system at the same time. That example is a bit oversimplified.
A more common and realistic example is a process that does something that should be done by at most one process at a time—for example, a process that needs exclusive access to a file on the file system or a process that periodically notifies users via SMS that it’s going to rain soon. See where we’re going with the latter? If we have more than one of this kind ...
Get Testing Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.