Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bccf0c2

Browse filesBrowse files
Add TestCoreBrokenDependency to core_test.go
1 parent a8007b8 commit bccf0c2
Copy full SHA for bccf0c2

File tree

Expand file treeCollapse file tree

2 files changed

+52
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+52
-3
lines changed

‎internal/integrationtest/core/core_test.go

Copy file name to clipboardExpand all lines: internal/integrationtest/core/core_test.go
+20-2Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
150150
// update custom index and install test core (installed cores affect `core search`)
151151
_, _, err := cli.Run("core", "update-index", "--additional-urls="+url.String())
152152
require.NoError(t, err)
153-
_, _, err = cli.Run("core", "install", "test:x86", "--additional-urls="+url.String())
153+
_, _, err = cli.Run("core", "install", "test:x86@2.0.0", "--additional-urls="+url.String())
154154
require.NoError(t, err)
155155

156156
// list all with no additional urls, ensure the test core won't show up
@@ -725,7 +725,7 @@ func TestCoreListSortedResults(t *testing.T) {
725725
require.NoError(t, err)
726726

727727
// install some core for testing
728-
_, _, err = cli.Run("core", "install", "test:x86", "Retrokits-RK002:arm", "Package:x86", "--additional-urls="+url.String())
728+
_, _, err = cli.Run("core", "install", "test:x86@2.0.0", "Retrokits-RK002:arm", "Package:x86", "--additional-urls="+url.String())
729729
require.NoError(t, err)
730730

731731
// list all with additional url specified
@@ -1006,3 +1006,21 @@ func TestCoreInstallRunsToolPostInstallScript(t *testing.T) {
10061006
require.NoError(t, err)
10071007
require.Contains(t, string(stdout), "Skipping tool configuration.")
10081008
}
1009+
1010+
func TestCoreBrokenDependency(t *testing.T) {
1011+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1012+
defer env.CleanUp()
1013+
1014+
// Set up an http server to serve our custom index file
1015+
test_index := paths.New("..", "testdata", "test_index.json")
1016+
url := env.HTTPServeFile(8000, test_index)
1017+
1018+
// Run update-index with our test index
1019+
_, _, err := cli.Run("core", "update-index", "--additional-urls="+url.String())
1020+
require.NoError(t, err)
1021+
1022+
// Check that the download fails and the correct message is displayed
1023+
_, stderr, err := cli.Run("core", "install", "test:x86@3.0.0", "--additional-urls="+url.String())
1024+
require.Error(t, err)
1025+
require.Contains(t, string(stderr), "try contacting test@example.com")
1026+
}

‎internal/integrationtest/testdata/test_index.json

Copy file name to clipboardExpand all lines: internal/integrationtest/testdata/test_index.json
+32-1Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,40 @@
4444
"name": "Test Board"
4545
}
4646
]
47+
},
48+
{
49+
"category": "Test Category",
50+
"help": {
51+
"online": "https://github.com/Arduino/arduino-cli"
52+
},
53+
"url": "https://raw.githubusercontent.com/arduino/arduino-cli/master/internal/integrationtest/testdata/core.zip",
54+
"checksum": "SHA-256:6a338cf4d6d501176a2d352c87a8d72ac7488b8c5b82cdf2a4e2cef630391092",
55+
"name": "test_core",
56+
"version": "3.0.0",
57+
"architecture": "x86",
58+
"archiveFileName": "core.zip",
59+
"size": "486",
60+
"toolsDependencies": [
61+
{
62+
"packager": "test",
63+
"version": "1.0.6",
64+
"name": "rp2040tools"
65+
}
66+
],
67+
"boards": [
68+
{
69+
"name": "Test Board"
70+
}
71+
]
72+
}
73+
],
74+
"tools": [
75+
{
76+
"name": "rp2040tools",
77+
"version": "1.0.6",
78+
"systems": []
4779
}
4880
],
49-
"tools": [],
5081
"email": "test@example.com",
5182
"name": "test"
5283
},

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.