Skip to content

Set installed property for installed platform when core search is executed #2223

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
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions commands/core/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse
out := make([]*rpc.Platform, len(res))
for i, platformRelease := range res {
out[i] = commands.PlatformReleaseToRPC(platformRelease)
if platformRelease.IsInstalled() {
out[i].Installed = platformRelease.Version.String()
}
}
// Sort result alphabetically and put deprecated platforms at the bottom
sort.Slice(
Expand Down
4 changes: 4 additions & 0 deletions internal/integrationtest/core/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ func TestCoreSearch(t *testing.T) {
require.NoError(t, err)
require.Greater(t, len(strings.Split(string(out), "\n")), 2)

_, _, err = cli.Run("core", "install", "arduino:[email protected]")
require.NoError(t, err)
out, _, err = cli.Run("core", "search", "avr", "--format", "json")
require.NoError(t, err)
requirejson.NotEmpty(t, out)
// Verify that "installed" is set
requirejson.Contains(t, out, `[{installed: "1.8.6"}]`)

// additional URL
out, _, err = cli.Run("core", "search", "test_core", "--format", "json", "--additional-urls="+url.String())
Expand Down