@@ -80,7 +80,7 @@ func TestCoreSearch(t *testing.T) {
8080 // show all versions
8181 out , _ , err = cli .Run ("core" , "search" , "test_core" , "--all" , "--format" , "json" , "--additional-urls=" + url .String ())
8282 require .NoError (t , err )
83- requirejson .Len (t , out , 2 )
83+ requirejson .Len (t , out , 3 )
8484
8585 checkPlatformIsInJSONOutput := func (stdout []byte , id , version string ) {
8686 jqquery := fmt .Sprintf (`[{id:"%s", latest:"%s"}]` , id , version )
@@ -150,7 +150,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
150150 // update custom index and install test core (installed cores affect `core search`)
151151 _ , _ , err := cli .Run ("core" , "update-index" , "--additional-urls=" + url .String ())
152152 require .NoError (t , err )
153- _ , _ , err = cli .Run ("core" , "install" , "test:x86" , "--additional-urls=" + url .String ())
153+ _ , _ , err = cli .Run ("core" , "install" , "test:x86@2.0.0 " , "--additional-urls=" + url .String ())
154154 require .NoError (t , err )
155155
156156 // list all with no additional urls, ensure the test core won't show up
@@ -161,7 +161,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
161161 lines = append (lines , strings .Fields (strings .TrimSpace (v )))
162162 }
163163 // The header is printed on the first lines
164- require .Equal (t , []string {"test:x86" , "2.0.0" , "test_core" }, lines [20 ])
164+ require .Equal (t , []string {"test:x86" , "2.0.0" , "test_core" }, lines [21 ])
165165 numPlatforms := len (lines ) - 1
166166
167167 // same thing in JSON format, also check the number of platforms found is the same
@@ -178,7 +178,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
178178 lines = append (lines , strings .Fields (strings .TrimSpace (v )))
179179 }
180180 // The header is printed on the first lines
181- require .Equal (t , []string {"test:x86" , "2 .0.0" , "test_core" }, lines [21 ])
181+ require .Equal (t , []string {"test:x86" , "3 .0.0" , "test_core" }, lines [22 ])
182182 numPlatforms = len (lines ) - 1
183183
184184 // same thing in JSON format, also check the number of platforms found is the same
@@ -725,7 +725,7 @@ func TestCoreListSortedResults(t *testing.T) {
725725 require .NoError (t , err )
726726
727727 // install some core for testing
728- _ , _ , err = cli .Run ("core" , "install" , "test:x86" , "Retrokits-RK002:arm" , "Package:x86" , "--additional-urls=" + url .String ())
728+ _ , _ , err = cli .Run ("core" , "install" , "test:x86@2.0.0 " , "Retrokits-RK002:arm" , "Package:x86" , "--additional-urls=" + url .String ())
729729 require .NoError (t , err )
730730
731731 // list all with additional url specified
@@ -1006,3 +1006,21 @@ func TestCoreInstallRunsToolPostInstallScript(t *testing.T) {
10061006 require .NoError (t , err )
10071007 require .Contains (t , string (stdout ), "Skipping tool configuration." )
10081008}
1009+
1010+ func TestCoreBrokenDependency (t * testing.T ) {
1011+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
1012+ defer env .CleanUp ()
1013+
1014+ // Set up an http server to serve our custom index file
1015+ test_index := paths .New (".." , "testdata" , "test_index.json" )
1016+ url := env .HTTPServeFile (8000 , test_index )
1017+
1018+ // Run update-index with our test index
1019+ _ , _ , err := cli .Run ("core" , "update-index" , "--additional-urls=" + url .String ())
1020+ require .NoError (t , err )
1021+
1022+ // Check that the download fails and the correct message is displayed
1023+ _ ,
stderr ,
err := cli .
Run (
"core" ,
"install" ,
"test:[email protected] " ,
"--additional-urls=" + url .
String ())
1024+ require .Error (t , err )
1025+ require .
Contains (
t ,
string (
stderr ),
"try contacting [email protected] " )
1026+ }
0 commit comments