Skip to content

Commit 3b41351

Browse files
cmagliealessio-perugini
authored andcommitted
Adapted some integration tests
1 parent 175a6d2 commit 3b41351

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

internal/integrationtest/arduino-cli.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,14 @@ func (inst *ArduinoCLIInstance) PlatformUpgrade(ctx context.Context, packager, a
576576
return installCl, err
577577
}
578578

579-
// PlatformList calls the "PlatformList" gRPC method.
580-
func (inst *ArduinoCLIInstance) PlatformList(ctx context.Context) (*commands.PlatformListResponse, error) {
581-
req := &commands.PlatformListRequest{Instance: inst.instance}
582-
logCallf(">>> PlatformList(%+v)\n", req)
583-
resp, err := inst.cli.daemonClient.PlatformList(ctx, req)
579+
// PlatformSearch calls the "PlatformSearch" gRPC method.
580+
func (inst *ArduinoCLIInstance) PlatformSearch(ctx context.Context, args string, all bool) (*commands.PlatformSearchResponse, error) {
581+
req := &commands.PlatformSearchRequest{
582+
Instance: inst.instance,
583+
SearchArgs: args,
584+
AllVersions: all,
585+
}
586+
logCallf(">>> PlatformSearch(%+v)\n", req)
587+
resp, err := inst.cli.daemonClient.PlatformSearch(ctx, req)
584588
return resp, err
585589
}

internal/integrationtest/daemon/daemon_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestDaemonAutoUpdateIndexOnFirstInit(t *testing.T) {
104104
fmt.Printf("INIT> %v\n", ir.GetMessage())
105105
}))
106106

107-
_, err := grpcInst.PlatformList(context.Background())
107+
_, err := grpcInst.PlatformSearch(context.Background(), "", true)
108108
require.NoError(t, err)
109109

110110
require.FileExists(t, cli.DataDir().Join("package_index.json").String())
@@ -477,8 +477,8 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
477477
platform, upgradeError := analyzePlatformUpgradeClient(plUpgrade)
478478
require.NoError(t, upgradeError)
479479
require.NotNil(t, platform)
480-
require.True(t, platform.Indexed) // the esp866 is present in the additional-urls
481-
require.False(t, platform.MissingMetadata) // install.json is present
480+
require.True(t, platform.Metadata.Indexed) // the esp866 is present in the additional-urls
481+
require.False(t, platform.Release.MissingMetadata) // install.json is present
482482
})
483483
t.Run("and install.json is missing", func(t *testing.T) {
484484
env, cli := createEnvForDaemon(t)
@@ -497,9 +497,8 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
497497
platform, upgradeError := analyzePlatformUpgradeClient(plUpgrade)
498498
require.NoError(t, upgradeError)
499499
require.NotNil(t, platform)
500-
require.True(t, platform.Indexed) // the esp866 is not present in the additional-urls
501-
require.False(t, platform.MissingMetadata) // install.json is present because the old version got upgraded
502-
500+
require.True(t, platform.Metadata.Indexed) // the esp866 is not present in the additional-urls
501+
require.False(t, platform.Release.MissingMetadata) // install.json is present because the old version got upgraded
503502
})
504503
})
505504

@@ -521,8 +520,8 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
521520
platform, upgradeError := analyzePlatformUpgradeClient(plUpgrade)
522521
require.ErrorIs(t, upgradeError, (&arduino.PlatformAlreadyAtTheLatestVersionError{Platform: "esp8266:esp8266"}).ToRPCStatus().Err())
523522
require.NotNil(t, platform)
524-
require.False(t, platform.Indexed) // the esp866 is not present in the additional-urls
525-
require.False(t, platform.MissingMetadata) // install.json is present
523+
require.False(t, platform.Metadata.Indexed) // the esp866 is not present in the additional-urls
524+
require.False(t, platform.Release.MissingMetadata) // install.json is present
526525
})
527526
t.Run("missing both additional URLs and install.json", func(t *testing.T) {
528527
env, cli := createEnvForDaemon(t)
@@ -546,8 +545,8 @@ func TestDaemonCoreUpgradePlatform(t *testing.T) {
546545
platform, upgradeError := analyzePlatformUpgradeClient(plUpgrade)
547546
require.ErrorIs(t, upgradeError, (&arduino.PlatformAlreadyAtTheLatestVersionError{Platform: "esp8266:esp8266"}).ToRPCStatus().Err())
548547
require.NotNil(t, platform)
549-
require.False(t, platform.Indexed) // the esp866 is not present in the additional-urls
550-
require.True(t, platform.MissingMetadata) // install.json is present
548+
require.False(t, platform.Metadata.Indexed) // the esp866 is not present in the additional-urls
549+
require.True(t, platform.Release.MissingMetadata) // install.json is present
551550
})
552551
})
553552
}

0 commit comments

Comments
 (0)