8000 Automatically download indexes, if missing, in gRPC `Init` call by cmaglie · Pull Request #2119 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

Automatically download indexes, if missing, in gRPC Init call #2119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test for #1529
  • Loading branch information
cmaglie committed Jun 16, 2023
commit 7ace61c27f68e9470ed525baa5f1174608b78d62
8 changes: 8 additions & 0 deletions internal/integrationtest/arduino-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,11 @@ func (inst *ArduinoCLIInstance) PlatformUpgrade(ctx context.Context, packager, a
logCallf(">>> PlatformUpgrade(%v:%v)\n", packager, arch)
return installCl, err
}

// PlatformList calls the "PlatformList" gRPC method.
func (inst *ArduinoCLIInstance) PlatformList(ctx context.Context) (*commands.PlatformListResponse, error) {
req := &commands.PlatformListRequest{Instance: inst.instance}
logCallf(">>> PlatformList(%+v)\n", req)
resp, err := inst.cli.daemonClient.PlatformList(ctx, req)
return resp, err
}
17 changes: 17 additions & 0 deletions internal/integrationtest/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ func TestArduinoCliDaemon(t *testing.T) {
testWatcher()
}

func TestDaemonAutoUpdateIndexOnFirstInit(t *testing.T) {
// https://github.com/arduino/arduino-cli/issues/1529

env, cli := createEnvForDaemon(t)
defer env.CleanUp()

grpcInst := cli.Create()
require.NoError(t, grpcInst.Init("", "", func(ir *commands.InitResponse) {
fmt.Printf("INIT> %v\n", ir.GetMessage())
}))

_, err := grpcInst.PlatformList(context.Background())
require.NoError(t, err)

require.FileExists(t, cli.DataDir().Join("package_index.json").String())
}

// createEnvForDaemon performs the minimum required operations to start the arduino-cli daemon.
// It returns a testsuite.Environment and an ArduinoCLI client to perform the integration tests.
// The Environment must be disposed by calling the CleanUp method via defer.
Expand Down
0