Wrong. If your boss tells you to do something illegal you are not required to obey; in fact the opposite. He received a lawful subpoena and testified truthfully. He followed the law.
I once had a supervisor order me to falsify data. I refused. He called me every name in the book, screamed, threatened to fire me. I told him if he did I would report to the FDA the company was falsifying data, and I had proof.
He didn't fire me but a few months later they told me business was slow and they needed layoff. Just one person laid off. Me.
The company folded not long after.