All perfect praise be to Allah, The Lord of The Worlds, and may His peace and blessings be upon our Prophet Muhammad and upon all of his family and companions.
Concealing a testimony is prohibited if a person was the principle witness and his act of remaining behind for attesting will cause losing others' rights.
Moreover, if he knew that such an act will cause losing others' rights then he is obliged to attest. The degree of obligation increases if the judge called him for a testimony and the latter didn't respond, since Allah, The most Exalted, Said (What means): "The witnesses should not refuse when they are called on (For evidence)" [Al-Baqarah/282] also, He Said (What means):" Conceal not evidence; for whoever conceals it,- His heart is tainted with sin. And God Knoweth all that ye do." [Al-Baqarah/283]. In addition, Al-Imam Al-Imrani said (What means): "Testimony becomes an obligation when a judge call the principle witness for it." [Al-Bayan Fee Madhab Al-Imam Al-Shafei'].
Therefore, kinship ties aren't enough reason not to testify regardless of troubles you will encounter since there is no obedience to the creation in disobedience of the Creator. And Allah Knows Best.