Skip to content

Commit a4eb173

Browse files
committed
Added integration test
1 parent b0b12f3 commit a4eb173

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

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

+46-3
Original file line numberDiff line numberDiff line change
@@ -1655,9 +1655,6 @@ func TestDependencyResolver(t *testing.T) {
16551655
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
16561656
defer env.CleanUp()
16571657

1658-
_, _, err := cli.Run("lib", "update-index")
1659-
require.NoError(t, err)
1660-
16611658
done := make(chan bool)
16621659
go func() {
16631660
_, _, err := cli.Run("lib", "install", "NTPClient_Generic")
@@ -1671,3 +1668,49 @@ func TestDependencyResolver(t *testing.T) {
16711668
require.FailNow(t, "The install command didn't complete in the allocated time")
16721669
}
16731670
}
1671+
1672+
func TestDependencyResolverNoOverwrite(t *testing.T) {
1673+
// https://github.com/arduino/arduino-cli/issues/1799
1674+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1675+
defer env.CleanUp()
1676+
1677+
_, _, err := cli.Run("lib", "install", "[email protected]")
1678+
require.NoError(t, err)
1679+
1680+
out, _, err := cli.Run("lib", "deps", "[email protected]", "--format", "json")
1681+
require.NoError(t, err)
1682+
outjson := requirejson.Parse(t, out)
1683+
outjson.MustContain(`{
1684+
"dependencies": [
1685+
{
1686+
"name": "Bounce2",
1687+
"version_installed": "2.53"
1688+
},
1689+
{
1690+
"name": "EncoderTool",
1691+
"version_required": "2.2.0"
1692+
}
1693+
]
1694+
}`)
1695+
require.NotEqual(t, outjson.Query("dependencies[0].version_required").String(), `"2.53.0"`)
1696+
1697+
out, _, err = cli.Run("lib", "deps", "[email protected]", "--no-overwrite", "--format", "json")
1698+
require.NoError(t, err)
1699+
outjson = requirejson.Parse(t, out)
1700+
outjson.MustContain(`{
1701+
"dependencies": [
1702+
{
1703+
"name": "Bounce2",
1704+
"version_required": "2.53.0",
1705+
"version_installed": "2.53"
1706+
},
1707+
{
1708+
"name": "EncoderTool",
1709+
"version_required": "2.2.0"
1710+
}
1711+
]
1712+
}`)
1713+
1714+
_, _, err = cli.Run("lib", "install", "[email protected]", "--no-overwrite")
1715+
require.NoError(t, err)
1716+
}

0 commit comments

Comments
 (0)