Skip to content

Commit

Permalink
Clean case directory during preparation step
Browse files Browse the repository at this point in the history
* Cleaning directory is crutial to avoid unexpected uptest behavior when
the cases are changing between uptest run
* The cases contents can change during the uptest version upgrade
  and when we use `--skip-delete` option
* Without this change the uptest behavior is confusing the user, e.g.
  the `--skip-delete` option does not effectively work after the
  standard run because `03-delete.yaml` case is not getting removed from
  the case directory

Signed-off-by: Yury Tsarev <yury@upbound.io>
  • Loading branch information
ytsarev committed Jan 18, 2024
1 parent bde6d12 commit 220ac54
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ type preparer struct {

func (p *preparer) prepareManifests() ([]config.Manifest, error) {

Check failure on line 80 in internal/prepare.go

View workflow job for this annotation

GitHub Actions / lint

cyclomatic complexity 11 of func `(*preparer).prepareManifests` is high (> 10) (gocyclo)
caseDirectory := filepath.Join(p.testDirectory, caseDirectory)
if err := os.RemoveAll(caseDirectory); err != nil {
return nil, errors.Wrapf(err, "cannot clean directory %s", caseDirectory)
}
if err := os.MkdirAll(caseDirectory, os.ModePerm); err != nil {
return nil, errors.Wrapf(err, "cannot create directory %s", caseDirectory)
}
Expand Down

0 comments on commit 220ac54

Please sign in to comment.