Two laboratories just got the job of quality testing Minnesota's medical marijuana.

The state is just two months away from the first legal sales of the drug. On Wednesday, the Minnesota Department of Health named its two testing facilities: Aspen Research Corp. of Maple Grove, and Legend Technical Services Inc., of St. Paul. The labs will test cannabis products to ensure they're free of pesticides and contaminants and to confirm that they contain the drug compounds and potency promised on the label.

"Minnesota's medical cannabis program focuses on providing patients with reliable, safe, medications," Health Department Assistant Commissioner Manny Munson-Regala said in a statement. "These labs will play a key role in ensuring these products meet Minnesota's high medical standards."

The state's entire supply of medical cannabis will be grown at just two facilities — LeafLine Labs in Cottage Grove and Minnesota Medical Solutions in Otsego. The manufacturers will grow the plants and process them into pills and liquids, since smoking medical marijuana and the sale of the raw plant itself will remain illegal in Minnesota.

Some strains of marijuana are high in THC — the compound that gives pot its buzz and that cancer patients might use to dull the pain and nausea of chemotherapy. Other strains, rich in cannabidiol, or CBD, are given to patients with conditions like epilepsy. Or patients might be prescribed a blend of CBD and THC. The labs will test the pills and oils to ensure that they're labeled properly.

The labs were chosen after a lengthy screening process, and the Health Department reports that both are already state certified for other types of testing.

Patients with qualifying conditions — such as certain cancers or terminal illnesses, HIV, seizure disorders, multiple sclerosis, glaucoma or Crohn's disease — can enroll in the medical cannabis patient registry starting June 1. There is an annual $200 registration fee, in addition to the actual cost of the drug, although low-income patients can get a reduced $50 fee.

The first of the state's eight medical marijuana clinics will open July 1.