I've heard of various non destructive testing methods being used to check the integrity of metals in aerospace, such as ultrasound and radiography. This may well be enough if the part is actually made of what it's supposed to be.
Couldn't they just buy an extra and destructively test that?
This happens all the time in construction of multistory buildings. When the floors of concrete are poured, they also produce smaller sections of concrete from the same batches. As the concrete cures, it's strength is tested. This ensures that the concrete can support the weight designated in the plans. Better to watch a test pour fail than the building collapsing when cheap concrete fails under load.
[edit] oops, just read comments later in the thread stating the same thing
A similar issue stopped NASA from perfectly end-to-end testing the LEV before the moon landing.
According to the DoJ article: "the replacement cost of frangible joints provided to the MDA that included SPI extrusions is approximately $15.3 million, and NASA incurred approximately $9 million in investigative and other costs to determine the impact of SPI extrusions on NASA operations."
For economic reasons, some compromise needs to be reached between assurance and insurance.
Testing everything yourself works out well since you are receiving most of the raw material and doing the assembly either yourself or on site with a contractor. NASA doesn't built a lot of stuff themselves. Components can be so deep in levels of subcontracting that all NASA can do is just make sure everyone is adhering to proper engineering and manufacturing principles. The company that originally bought the aluminum I'm sure tested all of their finished components the right way but testing might not have been sufficient enough against how much stress the part is actually under during flight. Or testing weakened the part to the point where a failure was imminent but not obvious. Or the vendor doesn't really test their stuff extensively and relies on the customer to handle that. Either way, the part passes tests and gets sent to the customer where the they would integrate the part into their design and test it as well. Or not fully test it based on the idea that the next customer would test it. Who knows? Maybe they didn't test it hard enough or maybe it was most of a length of testing problem. The point is that NASA has neither the time or money to independently test parts and materials, they rely on their experienced contractors and subcontractors to do it.
If there isn't already, there needs to be some additional laws with government contractors to make sure those in a position of trust (like test lab technicians and their managers) receive no compensation based on whether or not material passes inspection or how much they test. Or force these kinds of labs to do independent 3rd party testing.