File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed 
internal/shared/util/image Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ func forceOwnershipRWX() archive.Filter {
2323		h .Uid  =  uid 
2424		h .Gid  =  gid 
2525		h .Mode  |=  0700 
26+ 		h .PAXRecords  =  nil 
27+ 		h .Xattrs  =  nil  //nolint:staticcheck 
2628		return  true , nil 
2729	}
2830}
Original file line number Diff line number Diff line change @@ -2,11 +2,39 @@ package image
22
33import  (
44	"archive/tar" 
5+ 	"os" 
56	"testing" 
67
78	"github.com/stretchr/testify/assert" 
9+ 	"github.com/stretchr/testify/require" 
10+ 	"k8s.io/apimachinery/pkg/util/rand" 
811)
912
13+ func  TestForceOwnershipRWX (t  * testing.T ) {
14+ 	h  :=  tar.Header {
15+ 		Name : "foo/bar" ,
16+ 		Mode : 0000 ,
17+ 		Uid :  rand .Int (),
18+ 		Gid :  rand .Int (),
19+ 		Xattrs : map [string ]string { //nolint:staticcheck 
20+ 			"foo" : "bar" ,
21+ 		},
22+ 		PAXRecords : map [string ]string {
23+ 			"fizz" : "buzz" ,
24+ 		},
25+ 	}
26+ 	ok , err  :=  forceOwnershipRWX ()(& h )
27+ 	require .NoError (t , err )
28+ 	assert .True (t , ok )
29+ 
30+ 	assert .Equal (t , "foo/bar" , h .Name )
31+ 	assert .Equal (t , int64 (0700 ), h .Mode )
32+ 	assert .Equal (t , os .Getuid (), h .Uid )
33+ 	assert .Equal (t , os .Getgid (), h .Gid )
34+ 	assert .Nil (t , h .PAXRecords )
35+ 	assert .Nil (t , h .Xattrs ) //nolint:staticcheck 
36+ }
37+ 
1038func  TestOnlyPath (t  * testing.T ) {
1139	type  testCase  struct  {
1240		name        string 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments