Thank you for trusting your question to JA today. I am a licensed attorney with over a decade of law practice and over 20 years of experience in the legal field. I’m happy to be of assistance.
Whether or not your failed test can be used against you depends on just when you self-reported. If you took the medication, self-reported and then were tested, the test can't be used.
If you took the medication, were tested and then self-reported before the test results came back, that doesn't legally count as self-reporting because it was precipitated by being tested. Therefore, the result could be used in coming up with your characterization of service following the separation.
You certainly have the right to request resignation in lieu of being charged, but that's not a right that has to be honored. They can accept it or reject your application. Typically though, a resignation is an Other than Honorable discharge, not an Honorable. The idea is that you trade an OTH to avoid a federal criminal conviction.
If you have any further questions, please let me know. I invite follow up questions, so use REPLY for those. If you have no further questions then good luck going forward and please do not forget to rate my service with a three, a four or preferably a five star rating so that I receive credit for working with you today. Please rate me based on my service and not on your satisfaction with the law, which I am not in control of and I am just reporting to you. Also, feel free to request me in the future, if you have questions concerning a different matter.