@@ -171,14 +171,15 @@ func Test_profilingContainerAdapter_HandleProfilingContainerLogs(t *testing.T) {
171171
172172func Test_renameResultFileName (t * testing.T ) {
173173 // Given
174- fileName := "/tmp/contprof-flamegraph.svg.gz"
174+ podName := "pod-name"
175+ fileName := "/tmp/flamegraph.svg.gz"
175176 timestamp , _ := time .Parse (time .RFC3339 , "2023-02-28T11:44:12.678378359Z" )
176177
177178 // When
178- result := renameResultFileName (fileName , timestamp )
179+ result := renameResultFileName (podName , fileName , timestamp )
179180
180181 // Then
181- assert .Equal (t , "contprof -flamegraph-2023-02-28T11_44_12Z.svg" , result )
182+ assert .Equal (t , "pod-name -flamegraph-2023-02-28T11_44_12Z.svg" , result )
182183}
183184
184185func Test_profilingContainerAdapter_GetRemoteFile (t * testing.T ) {
@@ -251,6 +252,7 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
251252 target : & config.TargetConfig {
252253 LocalPath : "/tmp" ,
253254 Compressor : compressor .None ,
255+ PodName : "pod-name" ,
254256 },
255257 }
256258 },
@@ -263,10 +265,10 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
263265 },
264266 then : func (t * testing.T , r result , f fields ) {
265267 require .NoError (t , r .err )
266- assert .Equal (t , filepath .Join (common .TmpDir (), "flamegraph-2023-02-28T11_44_12Z.svg" ), r .remoteFile )
268+ assert .Equal (t , filepath .Join (common .TmpDir (), "pod-name- flamegraph-2023-02-28T11_44_12Z.svg" ), r .remoteFile )
267269 },
268270 afterEach : func () {
269- _ = os .Remove (filepath .Join (common .TmpDir (), "flamegraph-2023-02-28T11_44_12Z.svg" ))
271+ _ = os .Remove (filepath .Join (common .TmpDir (), "pod-name- flamegraph-2023-02-28T11_44_12Z.svg" ))
270272 },
271273 },
272274 {
@@ -567,6 +569,7 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
567569 target : & config.TargetConfig {
568570 LocalPath : "/other" ,
569571 Compressor : compressor .None ,
572+ PodName : "pod-name" ,
570573 },
571574 }
572575 },
@@ -579,7 +582,7 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
579582 },
580583 then : func (t * testing.T , r result , f fields ) {
581584 require .Error (t , r .err )
582- assert .EqualError (t , r .err , "could not write result file: open /other/flamegraph-2023-02-28T11_44_12Z.svg: no such file or directory" )
585+ assert .EqualError (t , r .err , "could not write result file: open /other/pod-name- flamegraph-2023-02-28T11_44_12Z.svg: no such file or directory" )
583586 },
584587 },
585588 {
@@ -636,6 +639,7 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
636639 target : & config.TargetConfig {
637640 LocalPath : "/tmp" ,
638641 Compressor : compressor .None ,
642+ PodName : "pod-name" ,
639643 },
640644 }
641645 },
@@ -648,10 +652,10 @@ func Test_profilingContainerAdapter_GetRemoteFile(t *testing.T) {
648652 },
649653 then : func (t * testing.T , r result , f fields ) {
650654 require .NoError (t , r .err )
651- assert .Equal (t , filepath .Join (common .TmpDir (), "flamegraph-2023-02-28T11_44_12Z.svg" ), r .remoteFile )
655+ assert .Equal (t , filepath .Join (common .TmpDir (), "pod-name- flamegraph-2023-02-28T11_44_12Z.svg" ), r .remoteFile )
652656 },
653657 afterEach : func () {
654- _ = os .Remove (filepath .Join (common .TmpDir (), "flamegraph-2023-02-28T11_44_12Z.svg" ))
658+ _ = os .Remove (filepath .Join (common .TmpDir (), "pod-name- flamegraph-2023-02-28T11_44_12Z.svg" ))
655659 },
656660 },
657661 {
0 commit comments