@@ -21,7 +21,6 @@ import (
2121 "io"
2222 "testing"
2323
24- "github.com/arduino/arduino-cli/internal/integrationtest"
2524 "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2625 "github.com/stretchr/testify/require"
2726)
@@ -42,30 +41,35 @@ func TestDaemonCoreUpdateIndex(t *testing.T) {
4241 ` "http://downloads.arduino.cc/package_inexistent_index.json"]` )
4342 require .NoError (t , err )
4443
45- analyzeUpdateIndexClient := func (cl commands.ArduinoCoreService_UpdateIndexClient ) map [string ]* commands.DownloadProgressEnd {
46- analyzer := integrationtest . NewDownloadProgressAnalyzer (t )
44+ analyzeUpdateIndexClient := func (cl commands.ArduinoCoreService_UpdateIndexClient ) ( error , map [string ]* commands.DownloadProgressEnd ) {
45+ analyzer := NewDownloadProgressAnalyzer (t )
4746 for {
4847 msg , err := cl .Recv ()
48+ // fmt.Println("DOWNLOAD>", msg)
4949 if err == io .EOF {
50- break
50+ return nil , analyzer .Results
51+ }
52+ if err != nil {
53+ return err , analyzer .Results
5154 }
5255 require .NoError (t , err )
5356 analyzer .Process (msg .GetDownloadProgress ())
5457 }
55- return analyzer .Results
5658 }
5759
5860 {
5961 cl , err := grpcInst .UpdateIndex (context .Background (), true )
6062 require .NoError (t , err )
61- res := analyzeUpdateIndexClient (cl )
63+ err , res := analyzeUpdateIndexClient (cl )
64+ require .NoError (t , err )
6265 require .Len (t , res , 1 )
6366 require .True (t , res ["https://downloads.arduino.cc/packages/package_index.tar.bz2" ].Success )
6467 }
6568 {
6669 cl , err := grpcInst .UpdateIndex (context .Background (), false )
6770 require .NoError (t , err )
68- res := analyzeUpdateIndexClient (cl )
71+ err , res := analyzeUpdateIndexClient (cl )
72+ require .Error (t , err )
6973 require .Len (t , res , 3 )
7074 require .True (t , res ["https://downloads.arduino.cc/packages/package_index.tar.bz2" ].Success )
7175 require .True (t , res ["http://arduino.esp8266.com/stable/package_esp8266com_index.json" ].Success )
0 commit comments