Skip to content

Commit 7ace61c

Browse files
committed
Added test for arduino#1529
1 parent e5da0d6 commit 7ace61c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Diff for: internal/integrationtest/arduino-cli.go

+8
Original file line numberDiff line numberDiff line change
@@ -470,3 +470,11 @@ func (inst *ArduinoCLIInstance) PlatformUpgrade(ctx context.Context, packager, a
470470
logCallf(">>> PlatformUpgrade(%v:%v)\n", packager, arch)
471471
return installCl, err
472472
}
473+
474+
// PlatformList calls the "PlatformList" gRPC method.
475+
func (inst *ArduinoCLIInstance) PlatformList(ctx context.Context) (*commands.PlatformListResponse, error) {
476+
req := &commands.PlatformListRequest{Instance: inst.instance}
477+
logCallf(">>> PlatformList(%+v)\n", req)
478+
resp, err := inst.cli.daemonClient.PlatformList(ctx, req)
479+
return resp, err
480+
}

Diff for: internal/integrationtest/daemon/daemon_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ func TestArduinoCliDaemon(t *testing.T) {
8383
testWatcher()
8484
}
8585

86+
func TestDaemonAutoUpdateIndexOnFirstInit(t *testing.T) {
87+
// https://github.com/arduino/arduino-cli/issues/1529
88+
89+
env, cli := createEnvForDaemon(t)
90+
defer env.CleanUp()
91+
92+
grpcInst := cli.Create()
93+
require.NoError(t, grpcInst.Init("", "", func(ir *commands.InitResponse) {
94+
fmt.Printf("INIT> %v\n", ir.GetMessage())
95+
}))
96+
97+
_, err := grpcInst.PlatformList(context.Background())
98+
require.NoError(t, err)
99+
100+
require.FileExists(t, cli.DataDir().Join("package_index.json").String())
101+
}
102+
86103
// createEnvForDaemon performs the minimum required operations to start the arduino-cli daemon.
87104
// It returns a testsuite.Environment and an ArduinoCLI client to perform the integration tests.
88105
// The Environment must be disposed by calling the CleanUp method via defer.

0 commit comments

Comments
 (0)