From e80cd1f2fff592e7e88101c3a49585078c7b0ab4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 2 May 2023 13:40:15 +0200 Subject: [PATCH] Fixed integration test --- internal/integrationtest/core/core_test.go | 8 ++-- .../core/testdata/core_with_postinst.zip | Bin 0 -> 828 bytes .../package_with_postinstall_index.json | 41 ++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 internal/integrationtest/core/testdata/core_with_postinst.zip create mode 100644 internal/integrationtest/core/testdata/package_with_postinstall_index.json diff --git a/internal/integrationtest/core/core_test.go b/internal/integrationtest/core/core_test.go index 7b9c4aaedf8..55030c1d316 100644 --- a/internal/integrationtest/core/core_test.go +++ b/internal/integrationtest/core/core_test.go @@ -996,15 +996,17 @@ func TestCoreInstallRunsToolPostInstallScript(t *testing.T) { env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) defer env.CleanUp() - url := "http://drazzy.com/package_drazzy.com_index.json" + url := env.HTTPServeFile(8080, paths.New("testdata", "package_with_postinstall_index.json")) + env.HTTPServeFile(8081, paths.New("testdata", "core_with_postinst.zip")) - _, _, err := cli.Run("core", "update-index", "--additional-urls", url) + _, _, err := cli.Run("core", "update-index", "--additional-urls", url.String()) require.NoError(t, err) // Checks that the post_install script is correctly skipped on the CI - stdout, _, err := cli.Run("core", "install", "ATTinyCore:avr", "--verbose", "--additional-urls", url) + stdout, _, err := cli.Run("core", "install", "Test:x86", "--additional-urls", url.String()) require.NoError(t, err) require.Contains(t, string(stdout), "Skipping tool configuration.") + require.Contains(t, string(stdout), "Skipping platform configuration.") } func TestCoreBrokenDependency(t *testing.T) { diff --git a/internal/integrationtest/core/testdata/core_with_postinst.zip b/internal/integrationtest/core/testdata/core_with_postinst.zip new file mode 100644 index 0000000000000000000000000000000000000000..4855bc84a45aa932aa2cd145704dd48507ad2989 GIT binary patch literal 828 zcmWIWW@h1H00EKoMPXnDlwf0!VKCA&&@<2v4dG;9&Uh1$k_p7672FJrEH9WD7{EjT zTz^lrUI4Ow0l5C8{KTS^V!e`z60k|fr_06#;WKFpnn^-%lL~SYOVaX-a^YrO2bu-K zI9(-(<||QzS^32!@tJwWC5bsXdc_%FrzHWM1;RLuLk}b|?8YS}Lc9tJG!VuxkC91^ z8CS4NKtoZ0;jJTx35x_)NF?Af3o{B}W-%}@>_g&ZM3Q$Z1e$5hPdKsL1tZYpZz z0L{f3F$kYyMh(K;zm3-r=AuUw&}giYgfJR2nvjiFWrPK40kYBHNW&G#tZYE{Ft7sQ MMxgFeAZB0y0Lnm^#sB~S literal 0 HcmV?d00001 diff --git a/internal/integrationtest/core/testdata/package_with_postinstall_index.json b/internal/integrationtest/core/testdata/package_with_postinstall_index.json new file mode 100644 index 00000000000..7521acb12dd --- /dev/null +++ b/internal/integrationtest/core/testdata/package_with_postinstall_index.json @@ -0,0 +1,41 @@ +{ + "packages": [ + { + "maintainer": "Test", + "help": { + "online": "https://github.com/Arduino/arduino-cli" + }, + "websiteURL": "https://github.com/Arduino/arduino-cli", + "platforms": [ + { + "category": "Test Category", + "help": { + "online": "https://github.com/Arduino/arduino-cli" + }, + "url": "http://127.0.0.1:8081/core_with_postinst.zip", + "checksum": "SHA-256:b08f89eae117254f01215082a2504d94ab28560a7bf944f0b5dcd2772a8f0b7e", + "name": "test_core", + "version": "2.0.0", + "architecture": "x86", + "archiveFileName": "core.zip", + "size": "828", + "toolsDependencies": [ + { + "packager": "arduino", + "version": "6.3.0-arduino17", + "name": "avrdude" + } + ], + "boards": [ + { + "name": "Test Board" + } + ] + } + ], + "tools": [], + "email": "test@example.com", + "name": "test" + } + ] +}