New air filter before test.
Stock as possible before test. That big tune doesn't have a hope of passing a smoke test.
Major missing things in place.
Re-test is always "replaced air filter" for item 'fixed'. With receipt dated after first failure.
Otherwise we watch gov't employees and elected officials pat each other on the back for each "failure" and continue to require expensive yearly diesel emissions tests because the number of failures justifies it. Not only that but, 'modern' diesel emissions here are stricter than Europe for reasons like this. (The emission test costs me more than the plate fees on 20+ year old stuff.)
CA uses a visible smoke 'judgement' call. Yeah fail a couple times and you will have everything stock and still have a hard time passing at a referee station. Of course you vehicle will be unlicensed for months while you go through this. (Say if you do something really stupid like show up without a converter installed when the label/book says thou shalt have one. Then it is go time with a fine tooth comb on everything emissions including cat distance from engine and exhaust diameter factory spec.)
This is why you should think twice before tempting fate on an emissions test. Further even stock engines have a hard time passing (real tests) unless they are in A1 condition.
Older engines weren't designed for snap testing: in fact some have NOx limits on the emissions label, but, no smoke numbers. The emissions tests came after the engine design met emissions standards. Emission exempt Military engines are the worst to try and get to pass a smoke test. Imagine hanging up on the rollers due to lack of power to drive off them from an emissions friendly tune/tune up/settings to pass... I didn't say it was easy - just don't tempt fate.