File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ package gatewayapi
1515import (
1616 "context"
1717 "fmt"
18- "log"
1918 "strings"
2019 "time"
2120
@@ -205,7 +204,6 @@ spec:
205204 tls , err := s .DefaultDataplaneResource ().SSL ().List (context .Background ())
206205 assert .Nil (GinkgoT (), err , "list tls error" )
207206 assert .Len (GinkgoT (), tls , 1 , "tls number not expect" )
208- log .Println ("tls" , tls )
209207 assert .Len (GinkgoT (), tls [0 ].Certificates , 1 , "length of certificates not expect" )
210208 assert .Equal (GinkgoT (), Cert , tls [0 ].Certificates [0 ].Certificate , "tls cert not expect" )
211209 assert .ElementsMatch (GinkgoT (), []string {host , "*.api6.com" }, tls [0 ].Snis )
Original file line number Diff line number Diff line change @@ -110,7 +110,17 @@ func (a *adcDataplaneResource) dumpResources(ctx context.Context) (*translator.T
110110 ctxWithTimeout , cancel := context .WithTimeout (ctx , a .syncTimeout )
111111 defer cancel ()
112112
113- args := []string {"dump" , "-o" , "/tmp/dump.yaml" }
113+ // Create a temporary file for the adc dump
114+ tempFile , err := os .CreateTemp ("" , "adc-dump-*.yaml" )
115+ if err != nil {
116+ return nil , err
117+ }
118+ defer func () {
119+ _ = tempFile .Close ()
120+ _ = os .Remove (tempFile .Name ())
121+ }()
122+
123+ args := []string {"dump" , "-o" , tempFile .Name ()}
114124 if ! a .tlsVerify {
115125 args = append (args , "--tls-skip-verify" )
116126 }
@@ -147,7 +157,7 @@ func (a *adcDataplaneResource) dumpResources(ctx context.Context) (*translator.T
147157 }
148158
149159 // Read the YAML file that was created by adc dump
150- yamlData , err := os .ReadFile ("/tmp/dump.yaml" )
160+ yamlData , err := os .ReadFile (tempFile . Name () )
151161 if err != nil {
152162 return nil , err
153163 }
You can’t perform that action at this time.
0 commit comments