Residual stress in electrical discharge coatings