Skip to content

Commit eb08523

Browse files
Migrate TestInstallWithGitUrlLocalFileUri to lib_test.go and delete test_lib.py
1 parent 3c57a02 commit eb08523

File tree

4 files changed

+43
-81
lines changed

4 files changed

+43
-81
lines changed

Diff for: go.mod

+6-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ require (
5454
gopkg.in/yaml.v3 v3.0.1
5555
)
5656

57+
require (
58+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
59+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
60+
)
61+
5762
require (
5863
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
5964
github.com/creack/goselect v0.1.2 // indirect
@@ -85,9 +90,8 @@ require (
8590
github.com/src-d/gcfg v1.4.0 // indirect
8691
github.com/subosito/gotenv v1.2.0 // indirect
8792
github.com/xanzy/ssh-agent v0.2.1 // indirect
88-
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
93+
go.lsp.dev/uri v0.3.0
8994
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
90-
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
9195
gopkg.in/ini.v1 v1.62.0 // indirect
9296
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
9397
gopkg.in/warnings.v0 v0.1.2 // indirect

Diff for: go.sum

+4
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=
@@ -461,6 +463,7 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
461463
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
462464
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
463465
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
466+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
464467
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
465468
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
466469
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
@@ -538,6 +541,7 @@ golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBc
538541
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
539542
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
540543
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
544+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
541545
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
542546
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
543547
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=

Diff for: internal/integrationtest/lib/lib_test.go

+33
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
)
@@ -1477,3 +1479,34 @@ func TestInstallWithZipPathMultipleLibraries(t *testing.T) {
14771479
require.DirExists(t, wifiInstallDir.String())
14781480
require.DirExists(t, bleInstallDir.String())
14791481
}
1482+
1483+
func TestInstallWithGitUrlLocalFileUri(t *testing.T) {
1484+
if runtime.GOOS == "windows" {
1485+
t.Skip("Using a file uri as git url doesn't work on Windows, " +
1486+
"this must be removed when this issue is fixed: https://github.com/go-git/go-git/issues/247")
1487+
}
1488+
1489+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1490+
defer env.CleanUp()
1491+
1492+
envVar := cli.GetDefaultEnv()
1493+
envVar["ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL"] = "true"
1494+
1495+
libInstallDir := cli.SketchbookDir().Join("libraries", "WiFi101")
1496+
// Verifies library is not installed
1497+
require.NoDirExists(t, libInstallDir.String())
1498+
1499+
// Clone repository locally
1500+
gitUrl := "https://github.com/arduino-libraries/WiFi101.git"
1501+
repoDir := cli.SketchbookDir().Join("WiFi101")
1502+
_, err := git.PlainClone(repoDir.String(), false, &git.CloneOptions{
1503+
URL: gitUrl,
1504+
})
1505+
require.NoError(t, err)
1506+
1507+
_, _, err = cli.RunWithCustomEnv(envVar, "lib", "install", "--git-url", uri.New(repoDir.String()).Filename())
1508+
require.NoError(t, err)
1509+
1510+
// Verifies library is installed
1511+
require.DirExists(t, libInstallDir.String())
1512+
}

Diff for: test/test_lib.py

-79
This file was deleted.

0 commit comments

Comments
 (0)