About that test and my major.

So here’s the deal. I am an Astrophysics major as of right now. This is something I’m very passionate about and love learning about. I can talk about it to anyone for hours. I’m taking calculus, which I am passing with an A, and Astronomy. We just had our second test in Astro and I felt very confident about it. Turns out I shouldn’t have because I failed. Badly. I passed the first one just fine. During lecture, I understand the material and labs are something I can do with no difficulty. But seeing that test grade has shaken my entire resolve and making me rethink my major. Is this a sign I should change majors?
I’m pretty messed up about this so any insight would be greatly appreciated.