Access has proved uneven across the country, even as guidelines for who qualifies have broadened and the laboratories conducting tests have expanded, from the federal Centers for Disease Control and Prevention to state health departments and then to hospitals and private labs.

In areas of the country where the virus has been slow to appear, people have been able to obtain tests easily. But in New York, California, Washington State and Massachusetts, where the virus has spread rapidly and demand for tests is most high, it is very difficult.

The New York City Health Department has directed doctors only to order tests for patients in need of hospitalization. People with mild symptoms are being told to quarantine themselves at home. Even health care workers, at high risk of contracting the virus and transmitting it, have struggled to get tested.

In New Rochelle, a community north of Manhattan where the virus has spread, a sick mother was told she could not get tested because she hadn’t been to a global “hot spot.” In Boston, an employee at Biogen, a tech company where many dozens tested positive after a conference, was turned away because he didn’t have symptoms. On Twitter, the hashtag #CDCWontTestMe has been circulating for weeks.

In the eyes of some doctors, prominent figures appeared to be moving to the front of the line.

“As predicted, #COVID19 is exposing all of the societal inequities,” Dr. Uché Blackstock, an urgent care doctor in Brooklyn, wrote on Twitter. “It’s upsetting for me to 1) have to ration out #COVID19 testing to my patients, then 2) have to wait 5-7 days for the results, when celebrities are getting tested with ease and quick turnaround times.”

Police chiefs across the country are growing concerned that they cannot get their hands on tests.

“What’s frustrating is to continue to hear that there aren’t testing kits available, and my rank and file have to continue to answer calls for service while professional athletes and movie stars are getting tested without even showing any symptoms,” said Eddie Garcia, the police chief of San Jose, Calif., on a conference call with law enforcement officials across the country.