Skip to content

Commit be1ee90

Browse files
committed
add tests to install esptool to verify #980
1 parent 2b824a8 commit be1ee90

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

main_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ func TestInstallToolV2(t *testing.T) {
116116
Signature: &bossacSignature,
117117
}
118118

119+
esptoolURL := "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/x86_64-linux-gnu.esptool-f80ae31.tar.gz"
120+
esptoolChecksum := "SHA-256:bded1dca953377838b6086a9bcd40a1dc5286ba5f69f2372c22a1d1819baad24"
121+
esptoolSignature := "852b58871419ce5e5633ecfaa72c0f0fa890ceb51164b362b8133bc0e3e003a21cec48935b8cdc078f4031219cbf17fb7edd9d7c9ca8ed85492911c9ca6353c9aa4691eb91fda99563a6bd49aeca0d9981fb05ec76e45c6024f8a6822862ad1e34ddc652fbbf4fa909887a255d4f087398ec386577efcec523c21203be3d10fc9e9b0f990a7536875a77dc2bc5cbffea7734b62238e31719111b718bacccebffc9be689545540e81d23b81caa66214376f58a0d6a45cf7efc5d3af62ab932b371628162fffe403906f41d5534921e5be081c5ac2ecc9db5caec03a105cc44b00ce19a95ad079843501eb8182e0717ce327867380c0e39d2b48698547fc1d0d66"
122+
esptoolInstallURLOK := tools.ToolPayload{
123+
Name: "esptool",
124+
Version: "2.5.0-3-20ed2b9",
125+
Packager: "esp8266",
126+
URL: &esptoolURL,
127+
Checksum: &esptoolChecksum,
128+
Signature: &esptoolSignature,
129+
}
130+
119131
wrongSignature := "wr0ngs1gn4tur3"
120132
bossacInstallWrongSig := tools.ToolPayload{
121133
Name: "bossac",
@@ -147,6 +159,7 @@ func TestInstallToolV2(t *testing.T) {
147159
{bossacInstallWrongSig, http.StatusInternalServerError, "verification error"},
148160
{bossacInstallWrongCheck, http.StatusInternalServerError, "checksum of downloaded file doesn't match"},
149161
{bossacInstallNoURL, http.StatusOK, "ok"},
162+
{esptoolInstallURLOK, http.StatusOK, "ok"},
150163
}
151164

152165
for _, test := range tests {

v2/pkgs/tools_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ func TestInstall(t *testing.T) {
231231
{Name: "rp2040tools", Version: "1.0.6", Packager: "arduino-test", URL: nil, Checksum: nil, Signature: nil},
232232
{Name: "esptool_py", Version: "4.5.1", Packager: "arduino-test", URL: nil, Checksum: nil, Signature: nil},
233233
{Name: "arduino-fwuploader", Version: "2.2.2", Packager: "arduino-test", URL: nil, Checksum: nil, Signature: nil},
234+
// test download of a tool not present in index. See https://github.com/arduino/arduino-create-agent/issues/980
235+
{Name: "esptool", Version: "2.5.0-3-20ed2b9", Packager: "esp8266", URL: strpoint("https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/x86_64-linux-gnu.esptool-f80ae31.tar.gz"), Checksum: strpoint("SHA-256:bded1dca953377838b6086a9bcd40a1dc5286ba5f69f2372c22a1d1819baad24"), Signature: strpoint("852b58871419ce5e5633ecfaa72c0f0fa890ceb51164b362b8133bc0e3e003a21cec48935b8cdc078f4031219cbf17fb7edd9d7c9ca8ed85492911c9ca6353c9aa4691eb91fda99563a6bd49aeca0d9981fb05ec76e45c6024f8a6822862ad1e34ddc652fbbf4fa909887a255d4f087398ec386577efcec523c21203be3d10fc9e9b0f990a7536875a77dc2bc5cbffea7734b62238e31719111b718bacccebffc9be689545540e81d23b81caa66214376f58a0d6a45cf7efc5d3af62ab932b371628162fffe403906f41d5534921e5be081c5ac2ecc9db5caec03a105cc44b00ce19a95ad079843501eb8182e0717ce327867380c0e39d2b48698547fc1d0d66")},
234236
}
235237

236238
expectedFiles := map[string][]string{
@@ -243,6 +245,7 @@ func TestInstall(t *testing.T) {
243245
"rp2040tools-1.0.6": {"elf2uf2", "picotool", "pioasm", "rp2040load"},
244246
"esptool_py-4.5.1": {"esptool"},
245247
"arduino-fwuploader-2.2.2": {"arduino-fwuploader"},
248+
"esptool-2.5.0-3-20ed2b9": {"esptool"},
246249
}
247250
for _, tc := range testCases {
248251
t.Run(tc.Name+"-"+tc.Version, func(t *testing.T) {
@@ -251,7 +254,7 @@ func TestInstall(t *testing.T) {
251254
require.NoError(t, err)
252255

253256
// Check that the tool has been downloaded
254-
toolDir := paths.New(tmp).Join("arduino-test", tc.Name, tc.Version)
257+
toolDir := paths.New(tmp).Join(tc.Packager, tc.Name, tc.Version)
255258
require.DirExists(t, toolDir.String())
256259

257260
// Check that the files have been created

0 commit comments

Comments
 (0)