@@ -37,7 +37,7 @@ import (
3737func TestArduinoCliDaemon (t * testing.T ) {
3838 // See: https://github.com/arduino/arduino-cli/pull/1804
3939
40- env , cli := createEnvForDaemon (t )
40+ env , cli := integrationtest . CreateEnvForDaemon (t )
4141 defer env .CleanUp ()
4242
4343 grpcInst := cli .Create ()
@@ -96,7 +96,7 @@ func TestArduinoCliDaemon(t *testing.T) {
9696func TestDaemonAutoUpdateIndexOnFirstInit (t * testing.T ) {
9797 // https://github.com/arduino/arduino-cli/issues/1529
9898
99- env , cli := createEnvForDaemon (t )
99+ env , cli := integrationtest . CreateEnvForDaemon (t )
100100 defer env .CleanUp ()
101101
102102 grpcInst := cli .Create ()
@@ -110,26 +110,11 @@ func TestDaemonAutoUpdateIndexOnFirstInit(t *testing.T) {
110110 require .FileExists (t , cli .DataDir ().Join ("package_index.json" ).String ())
111111}
112112
113- // createEnvForDaemon performs the minimum required operations to start the arduino-cli daemon.
114- // It returns a testsuite.Environment and an ArduinoCLI client to perform the integration tests.
115- // The Environment must be disposed by calling the CleanUp method via defer.
116- func createEnvForDaemon (t * testing.T ) (* integrationtest.Environment , * integrationtest.ArduinoCLI ) {
117- env := integrationtest .NewEnvironment (t )
118-
119- cli := integrationtest .NewArduinoCliWithinEnvironment (env , & integrationtest.ArduinoCLIConfig {
120- ArduinoCLIPath : integrationtest .FindRepositoryRootPath (t ).Join ("arduino-cli" ),
121- UseSharedStagingFolder : true ,
122- })
123-
124- _ = cli .StartDaemon (false )
125- return env , cli
126- }
127-
128113func TestDaemonCompileOptions (t * testing.T ) {
129114 // See: https://github.com/arduino/arduino-cli/issues/1614
130115 // See: https://github.com/arduino/arduino-cli/pull/1820
131116
132- env , cli := createEnvForDaemon (t )
117+ env , cli := integrationtest . CreateEnvForDaemon (t )
133118 defer env .CleanUp ()
134119
135120 grpcInst := cli .Create ()
@@ -203,7 +188,7 @@ func TestDaemonCompileOptions(t *testing.T) {
203188func TestDaemonCompileAfterFailedLibInstall (t * testing.T ) {
204189 // See: https://github.com/arduino/arduino-cli/issues/1812
205190
206- env , cli := createEnvForDaemon (t )
191+ env , cli := integrationtest . CreateEnvForDaemon (t )
207192 defer env .CleanUp ()
208193
209194 grpcInst := cli .Create ()
@@ -233,7 +218,7 @@ func TestDaemonCompileAfterFailedLibInstall(t *testing.T) {
233218}
234219
235220func TestDaemonCoreUpdateIndex (t * testing.T ) {
236- env , cli := createEnvForDaemon (t )
221+ env , cli := integrationtest . CreateEnvForDaemon (t )
237222 defer env .CleanUp ()
238223
239224 grpcInst := cli .Create ()
@@ -269,7 +254,7 @@ func TestDaemonCoreUpdateIndex(t *testing.T) {
269254}
270255
271256func TestDaemonBundleLibInstall (t * testing.T ) {
272- env , cli := createEnvForDaemon (t )
257+ env , cli := integrationtest . CreateEnvForDaemon (t )
273258 defer env .CleanUp ()
274259
275260 grpcInst := cli .Create ()
@@ -409,7 +394,7 @@ func TestDaemonLibrariesRescanOnInstall(t *testing.T) {
409394 with the gprc instance
410395 The last attempt is expected to not raise an error
411396 */
412- env , cli := createEnvForDaemon (t )
397+ env , cli := integrationtest . CreateEnvForDaemon (t )
413398 defer env .CleanUp ()
414399
415400 grpcInst := cli .Create ()
@@ -465,7 +450,7 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
465450
466451 t .Run ("upgraded successfully with additional urls" , func (t * testing.T ) {
467452 t .Run ("and install.json is present" , func (t * testing.T ) {
468- env , cli := createEnvForDaemon (t )
453+ env , cli := integrationtest . CreateEnvForDaemon (t )
469454 defer env .CleanUp ()
470455
471456 grpcInst := cli .Create ()
@@ -481,7 +466,7 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
481466 require .False (t , platform .GetRelease ().GetMissingMetadata ()) // install.json is present
482467 })
483468 t .Run ("and install.json is missing" , func (t * testing.T ) {
484- env , cli := createEnvForDaemon (t )
469+ env , cli := integrationtest . CreateEnvForDaemon (t )
485470 defer env .CleanUp ()
486471
487472 grpcInst := cli .Create ()
@@ -504,7 +489,7 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
504489
505490 t .Run ("upgrade failed" , func (t * testing.T ) {
506491 t .Run ("without additional URLs" , func (t * testing.T ) {
507- env , cli := createEnvForDaemon (t )
492+ env , cli := integrationtest . CreateEnvForDaemon (t )
508493 defer env .CleanUp ()
509494
510495 grpcInst := cli .Create ()
@@ -524,7 +509,7 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
524509 require .False (t , platform .GetRelease ().GetMissingMetadata ()) // install.json is present
525510 })
526511 t .Run ("missing both additional URLs and install.json" , func (t * testing.T ) {
527- env , cli := createEnvForDaemon (t )
512+ env , cli := integrationtest . CreateEnvForDaemon (t )
528513 defer env .CleanUp ()
529514
530515 grpcInst := cli .Create ()
0 commit comments