Skip to content

Commit 6e8e167

Browse files
Use absolute path to create daemon environment
1 parent 6a77eda commit 6e8e167

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

internal/integrationtest/daemon/daemon_test.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,25 @@ import (
2424
"go.bug.st/testsuite"
2525
)
2626

27+
// FindRepositoryRootPath returns the repository root path
28+
func FindRepositoryRootPath(t *testing.T) *paths.Path {
29+
repoRootPath, err := paths.Getwd()
30+
require.NoError(t, err)
31+
for !repoRootPath.Join(".git").Exist() {
32+
require.Contains(t, repoRootPath.String(), "arduino-cli", "Error searching for repository root path")
33+
repoRootPath = repoRootPath.Parent()
34+
}
35+
return repoRootPath
36+
}
37+
2738
// createEnvForDaemon performs the minimum required operations to start the arduino-cli daemon.
2839
// It returns a testsuite.Environment and an ArduinoCLI client to perform the integration tests.
2940
// The Environment must be disposed by calling the CleanUp method via defer.
3041
func createEnvForDaemon(t *testing.T) (*testsuite.Environment, *integrationtest.ArduinoCLI) {
3142
env := testsuite.NewEnvironment(t)
3243

3344
cli := integrationtest.NewArduinoCliWithinEnvironment(env, &integrationtest.ArduinoCLIConfig{
34-
ArduinoCLIPath: paths.New("..", "..", "..", "arduino-cli"),
45+
ArduinoCLIPath: FindRepositoryRootPath(t).Join("arduino-cli"),
3546
UseSharedStagingFolder: true,
3647
})
3748

0 commit comments

Comments
 (0)