@@ -21,7 +21,6 @@ import (
21
21
"io"
22
22
"testing"
23
23
24
- "github.com/arduino/arduino-cli/internal/integrationtest"
25
24
"github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
26
25
"github.com/stretchr/testify/require"
27
26
)
@@ -42,30 +41,35 @@ func TestDaemonCoreUpdateIndex(t *testing.T) {
42
41
` "http://downloads.arduino.cc/package_inexistent_index.json"]` )
43
42
require .NoError (t , err )
44
43
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 )
47
46
for {
48
47
msg , err := cl .Recv ()
48
+ // fmt.Println("DOWNLOAD>", msg)
49
49
if err == io .EOF {
50
- break
50
+ return nil , analyzer .Results
51
+ }
52
+ if err != nil {
53
+ return err , analyzer .Results
51
54
}
52
55
require .NoError (t , err )
53
56
analyzer .Process (msg .GetDownloadProgress ())
54
57
}
55
- return analyzer .Results
56
58
}
57
59
58
60
{
59
61
cl , err := grpcInst .UpdateIndex (context .Background (), true )
60
62
require .NoError (t , err )
61
- res := analyzeUpdateIndexClient (cl )
63
+ err , res := analyzeUpdateIndexClient (cl )
64
+ require .NoError (t , err )
62
65
require .Len (t , res , 1 )
63
66
require .True (t , res ["https://downloads.arduino.cc/packages/package_index.tar.bz2" ].Success )
64
67
}
65
68
{
66
69
cl , err := grpcInst .UpdateIndex (context .Background (), false )
67
70
require .NoError (t , err )
68
- res := analyzeUpdateIndexClient (cl )
71
+ err , res := analyzeUpdateIndexClient (cl )
72
+ require .Error (t , err )
69
73
require .Len (t , res , 3 )
70
74
require .True (t , res ["https://downloads.arduino.cc/packages/package_index.tar.bz2" ].Success )
71
75
require .True (t , res ["http://arduino.esp8266.com/stable/package_esp8266com_index.json" ].Success )
0 commit comments