File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -919,6 +919,8 @@ func TestGitRepositoryReconciler_reconcileArtifact(t *testing.T) {
919
919
t .Run (tt .name , func (t * testing.T ) {
920
920
g := NewWithT (t )
921
921
922
+ resetChmod (tt .dir , 0o755 , 0o644 )
923
+
922
924
r := & GitRepositoryReconciler {
923
925
EventRecorder : record .NewFakeRecorder (32 ),
924
926
Storage : testStorage ,
@@ -2142,3 +2144,24 @@ func TestGitRepositoryReconciler_calculateContentConfigChecksum(t *testing.T) {
2142
2144
artifactCsumModChecksum := r .calculateContentConfigChecksum (obj , artifacts )
2143
2145
g .Expect (artifactModChecksum ).ToNot (Equal (artifactCsumModChecksum ))
2144
2146
}
2147
+
2148
+ func resetChmod (path string , dirMode os.FileMode , fileMode os.FileMode ) error {
2149
+ err := filepath .Walk (path ,
2150
+ func (path string , info os.FileInfo , err error ) error {
2151
+ if err != nil {
2152
+ return err
2153
+ }
2154
+
2155
+ if info .IsDir () && info .Mode () != dirMode {
2156
+ os .Chmod (path , dirMode )
2157
+ } else if ! info .IsDir () && info .Mode () != fileMode {
2158
+ os .Chmod (path , fileMode )
2159
+ }
2160
+ return nil
2161
+ })
2162
+ if err != nil {
2163
+ return fmt .Errorf ("cannot reset file permissions: %v" , err )
2164
+ }
2165
+
2166
+ return nil
2167
+ }
You can’t perform that action at this time.
0 commit comments