Narrative:

I was conducting a functional test flight under VFR rules. When cleared for takeoff on runway xxr; tower cleared us to fly runway heading at or below 5000 feet. As soon as we rotated and weight off wheels; the cabin overpressurized and we leveled off at 2;200 feet MSL. Tower handed us off to approach control. I indicated that we needed to return and requested to re-enter the traffic pattern. Approach control directed us to turn left heading 040 so that he could coordinate a downwind back into the traffic pattern with tower. We did not declare an emergency due to the plane was flying safely and we were handling the pressurization issue. While on heading of 040 assigned by ATC at 2;200 feet; we got a traffic alert on TCAS. As soon as we looked up a T-6 was banking over the top of us with about 400 feet separation. At that time I realized we had flown through [an] AFB's traffic pattern. Then approach control realized what had happened and turned us to a heading of 300 to direct us away from [the AFB]. I then asked approach control if that was our fault since we were flying a vector given by them. I was told that everything would be worked out and we were ok. When I landed I called the TRACON and spoke to a controller; explained the situation. He told me that we were in the right and they had got busy trying to coordinate with the tower while the traffic conflict had happened.

Google
 

Original NASA ASRS Text

Title: Diamond Jet Captain reported an NMAC with a T-6 after entering an Air Force Base's airspace while following an ATC clearance.

Narrative: I was conducting a functional test flight under VFR rules. When cleared for takeoff on Runway XXR; Tower cleared us to fly runway heading at or below 5000 feet. As soon as we rotated and weight off wheels; the cabin overpressurized and we leveled off at 2;200 feet MSL. Tower handed us off to approach control. I indicated that we needed to return and requested to re-enter the traffic pattern. Approach Control directed us to turn left heading 040 so that he could coordinate a downwind back into the traffic pattern with Tower. We did not declare an emergency due to the plane was flying safely and we were handling the pressurization issue. While on heading of 040 assigned by ATC at 2;200 feet; we got a traffic alert on TCAS. As soon as we looked up a T-6 was banking over the top of us with about 400 feet separation. At that time I realized we had flown through [an] AFB's traffic pattern. Then Approach Control realized what had happened and turned us to a heading of 300 to direct us away from [the AFB]. I then asked Approach Control if that was our fault since we were flying a vector given by them. I was told that everything would be worked out and we were ok. When I landed I called the TRACON and spoke to a controller; explained the situation. He told me that we were in the right and they had got busy trying to coordinate with the Tower while the traffic conflict had happened.

Data retrieved from NASA's ASRS site and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.