File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,18 @@ func DownloadOCMAndAddToPath(t *testing.T) {
8484 t .Fatalf ("failed to chmod ocm binary: %v" , err )
8585 }
8686
87- if err := os .Symlink (ocmPath , filepath .Join (cacheDir , "ocm" )); err != nil {
87+ // if symlink already exists, remove it
88+ symlinkPath := filepath .Join (cacheDir , "ocm" )
89+ if _ , err := os .Lstat (symlinkPath ); err == nil {
90+ if err := os .Remove (symlinkPath ); err != nil {
91+ t .Fatalf ("failed to remove existing symlink: %v" , err )
92+ }
93+ } else if ! os .IsNotExist (err ) {
94+ t .Fatalf ("failed to check existing symlink: %v" , err )
95+ }
96+
97+ // create symlink to the ocm binary
98+ if err := os .Symlink (ocmPath , symlinkPath ); err != nil {
8899 t .Fatalf ("failed to create symlink for ocm binary: %v" , err )
89100 }
90101 } else {
You can’t perform that action at this time.
0 commit comments