Skip to content

Commit

Permalink
fix test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Dec 13, 2023
1 parent e2f2637 commit faab16a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
22 changes: 2 additions & 20 deletions internal/integrationtest/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func TestDaemonBundleLibInstall(t *testing.T) {
fmt.Printf("INIT> %v\n", ir.GetMessage())
}))

// Install libraries in bundled dir
// Install libraries
{
instCl, err := grpcInst.LibraryInstall(context.Background(), "Arduino_BuiltIn", "", false, false)
require.NoError(t, err)
Expand Down Expand Up @@ -363,10 +363,9 @@ func TestDaemonBundleLibInstall(t *testing.T) {
for _, lib := range resp.GetInstalledLibraries() {
libsAndLocation[lib.GetLibrary().GetName()] = lib.GetLibrary().GetLocation()
}
require.Contains(t, libsAndLocation, "Ethernet")
require.NotContains(t, libsAndLocation, "Ethernet")
require.Contains(t, libsAndLocation, "SD")
require.Contains(t, libsAndLocation, "Firmata")
require.Equal(t, libsAndLocation["Ethernet"], commands.LibraryLocation_LIBRARY_LOCATION_USER)
require.Equal(t, libsAndLocation["SD"], commands.LibraryLocation_LIBRARY_LOCATION_USER)
require.Equal(t, libsAndLocation["Firmata"], commands.LibraryLocation_LIBRARY_LOCATION_USER)
}
Expand All @@ -379,23 +378,6 @@ func TestDaemonBundleLibInstall(t *testing.T) {
require.NoError(t, grpcInst.Init("", "", func(ir *commands.InitResponse) {
fmt.Printf("INIT> %v\n", ir.GetMessage())
}))

// Install libraries in bundled dir (should now fail)
{
instCl, err := grpcInst.LibraryInstall(context.Background(), "Arduino_BuiltIn", "", false, false)
require.NoError(t, err)
for {
msg, err := instCl.Recv()
if errors.Is(err, io.EOF) {
require.FailNow(t, "LibraryInstall is supposed to fail because builtin libraries directory is not set")
}
if err != nil {
fmt.Println("LIB INSTALL ERROR:", err)
break
}
fmt.Printf("LIB INSTALL> %+v\n", msg)
}
}
}

func TestDaemonLibrariesRescanOnInstall(t *testing.T) {
Expand Down
12 changes: 0 additions & 12 deletions internal/integrationtest/lib/lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1556,18 +1556,6 @@ func TestLibQueryParameters(t *testing.T) {
stdout, _, err = cli.Run("lib", "download", "[email protected]", "-v", "--log-level", "debug", "--log-format", "json")
require.NoError(t, err)
require.Contains(t, string(stdout), `"url":"https://downloads.arduino.cc/libraries/github.com/arduino-libraries/WiFi101-0.16.1.zip?query=download"`)

// Check query=install-builtin when a library dependency is installed in builtin-directory
cliEnv := cli.GetDefaultEnv()
cliEnv["ARDUINO_DIRECTORIES_BUILTIN_LIBRARIES"] = cli.DataDir().Join("libraries").String()
stdout, _, err = cli.RunWithCustomEnv(cliEnv, "lib", "install", "[email protected]", "--install-in-builtin-dir", "-v", "--log-level", "debug", "--log-format", "json")
require.NoError(t, err)
require.Contains(t, string(stdout), `"url":"https://downloads.arduino.cc/libraries/github.com/firmata/Firmata-2.5.3.zip?query=install-builtin`)

// Check query=update-builtin when a library dependency is updated in builtin-directory
stdout, _, err = cli.RunWithCustomEnv(cliEnv, "lib", "install", "[email protected]", "--install-in-builtin-dir", "-v", "--log-level", "debug", "--log-format", "json")
require.NoError(t, err)
require.Contains(t, string(stdout), `"url":"https://downloads.arduino.cc/libraries/github.com/firmata/Firmata-2.5.9.zip?query=upgrade-builtin"`)
}

func TestLibBundlesWhenLibWithTheSameNameIsInstalledGlobally(t *testing.T) {
Expand Down

0 comments on commit faab16a

Please sign in to comment.