Skip to content

Commit 45e5c51

Browse files
Migrate TestInstallWithGitUrlLocalFileUri to lib_test.go and delete test_lib.py
1 parent 53bac3b commit 45e5c51

File tree

4 files changed

+36
-56
lines changed

4 files changed

+36
-56
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ require (
8686
github.com/src-d/gcfg v1.4.0 // indirect
8787
github.com/subosito/gotenv v1.2.0 // indirect
8888
github.com/xanzy/ssh-agent v0.2.1 // indirect
89+
go.lsp.dev/uri v0.3.0 // indirect
8990
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
9091
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
9192
gopkg.in/ini.v1 v1.62.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ go.bug.st/testifyjson v1.1.1/go.mod h1:nZyy2icFbv3OE3zW3mGVOnC/GhWgb93LRu+29n2tJ
367367
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
368368
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
369369
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
370+
go.lsp.dev/uri v0.3.0 h1:KcZJmh6nFIBeJzTugn5JTU6OOyG0lDOo3R9KwTxTYbo=
371+
go.lsp.dev/uri v0.3.0/go.mod h1:P5sbO1IQR+qySTWOCnhnK7phBx+W3zbLqSMDJNTw88I=
370372
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
371373
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
372374
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=

internal/integrationtest/lib/lib_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"io"
2222
"net/http"
23+
"runtime"
2324
"strings"
2425
"testing"
2526
"time"
@@ -28,6 +29,7 @@ import (
2829
"github.com/arduino/go-paths-helper"
2930
"github.com/stretchr/testify/require"
3031
"go.bug.st/testifyjson/requirejson"
32+
"go.lsp.dev/uri"
3133
"gopkg.in/src-d/go-git.v4"
3234
"gopkg.in/src-d/go-git.v4/plumbing/object"
3335
)
@@ -1475,3 +1477,34 @@ func TestInstallWithZipPathMultipleLibraries(t *testing.T) {
14751477
require.DirExists(t, wifiInstallDir.String())
14761478
require.DirExists(t, bleInstallDir.String())
14771479
}
1480+
1481+
func TestInstallWithGitUrlLocalFileUri(t *testing.T) {
1482+
if runtime.GOOS == "windows" {
1483+
t.Skip("Using a file uri as git url doesn't work on Windows, " +
1484+
"this must be removed when this issue is fixed: https://github.com/go-git/go-git/issues/247")
1485+
}
1486+
1487+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1488+
defer env.CleanUp()
1489+
1490+
envVar := cli.GetDefaultEnv()
1491+
envVar["ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL"] = "true"
1492+
1493+
libInstallDir := cli.SketchbookDir().Join("libraries", "WiFi101")
1494+
// Verifies library is not installed
1495+
require.NoDirExists(t, libInstallDir.String())
1496+
1497+
// Clone repository locally
1498+
gitUrl := "https://github.com/arduino-libraries/WiFi101.git"
1499+
repoDir := cli.SketchbookDir().Join("WiFi101")
1500+
_, err := git.PlainClone(repoDir.String(), false, &git.CloneOptions{
1501+
URL: gitUrl,
1502+
})
1503+
require.NoError(t, err)
1504+
1505+
_, _, err = cli.RunWithCustomEnv(envVar, "lib", "install", "--git-url", uri.New(repoDir.String()).Filename())
1506+
require.NoError(t, err)
1507+
1508+
// Verifies library is installed
1509+
require.DirExists(t, libInstallDir.String())
1510+
}

test/test_lib.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)