Skip to content

Commit

Permalink
fix(e2e/internal/directories): fix potential infinite loop (#6287)
Browse files Browse the repository at this point in the history
* fix: fix potential loop goes forever

* fix: wrong condition in the for loop

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
  • Loading branch information
kien6034 and crodriguezvega authored May 15, 2024
1 parent 5aa8922 commit 340ef64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion e2e/internal/directories/directories.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func E2E(t *testing.T) (string, error) {

const maxAttempts = 100
count := 0
for ; !strings.HasSuffix(wd, e2eDir) || count > maxAttempts; wd = path.Dir(wd) {
for ; !strings.HasSuffix(wd, e2eDir) && count < maxAttempts; wd = path.Dir(wd) {
count++
}

Expand Down

0 comments on commit 340ef64

Please sign in to comment.