Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7ace61c

Browse filesBrowse files
committed
Added test for #1529
1 parent e5da0d6 commit 7ace61c
Copy full SHA for 7ace61c

File tree

Expand file treeCollapse file tree

2 files changed

+25
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+25
-0
lines changed

‎internal/integrationtest/arduino-cli.go

Copy file name to clipboardExpand all lines: internal/integrationtest/arduino-cli.go
+8Lines changed: 8 additions & 0 deletions
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+
}

‎internal/integrationtest/daemon/daemon_test.go

Copy file name to clipboardExpand all lines: internal/integrationtest/daemon/daemon_test.go
+17Lines changed: 17 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.