Skip to content

Commit 000d10d

Browse files
committed
Fixed finding release.json in unit tests
1 parent 5132f96 commit 000d10d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

controllers/operator/appdbreplicaset_controller_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"os"
88
"path/filepath"
9-
"strings"
109
"testing"
1110
"time"
1211

@@ -54,15 +53,14 @@ func init() {
5453

5554
// getReleaseJsonPath searches for a specified target directory by traversing the directory tree backwards from the current working directory
5655
func getReleaseJsonPath() (string, error) {
57-
repositoryRootDirName := "mongodb-kubernetes"
5856
releaseFileName := "release.json"
5957

6058
currentDir, err := os.Getwd()
6159
if err != nil {
6260
return "", err
6361
}
6462
for currentDir != "/" {
65-
if strings.HasSuffix(currentDir, repositoryRootDirName) {
63+
if _, err := os.Stat(filepath.Join(currentDir, releaseFileName)); err == nil {
6664
return filepath.Join(currentDir, releaseFileName), nil
6765
}
6866
currentDir = filepath.Dir(currentDir)

0 commit comments

Comments
 (0)