Skip to content

Commit 103efc8

Browse files
Use local HTTP server instead of downloading file on test (#7545) (#7551)
Use a local httptest.Server instead of downloading robots.txt from Elastic's website on every test run. This makes removes the internet connection and the state of Elastic's website as source of flakiness for the test. (cherry picked from commit 757f282) Co-authored-by: Tiago Queiroz <[email protected]>
1 parent d151d35 commit 103efc8

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<79>2 2025-03-25T08:17:17.736Z nationalincubate.net voluptas 134 ID302 - Indexing the card won't do anything, we need to back up the 1080p AI alarm!
2+
<189>2 2025-03-25T08:17:17.736Z nationalextensible.com ut 7269 ID501 - I'Ll synthesize the open-source JBOD sensor, that should circuit the HDD transmitter!
3+
<92>2 2025-03-25T08:17:17.736Z principalmission-critical.info fugiat 214 ID539 - The USB matrix is down, reboot the virtual sensor so we can calculate the SAS system!
4+
<63>3 2025-03-25T08:17:17.736Z customersyndicate.org illo 4412 ID943 - Compressing the firewall won't do anything, we need to back up the digital TCP system!
5+
<9>1 2025-03-25T08:17:17.736Z centralsupply-chains.info saepe 1463 ID975 - Use the mobile ADP capacitor, then you can bypass the wireless feed!
6+
<6>3 2025-03-25T08:17:17.736Z globalvertical.name id 5862 ID780 - If we transmit the bus, we can get to the JBOD transmitter through the auxiliary JBOD hard drive!
7+
<115>3 2025-03-25T08:17:17.736Z corporatemagnetic.org eos 8629 ID675 - You can't calculate the bus without hacking the neural GB interface!
8+
<108>3 2025-03-25T08:17:17.736Z regionalwireless.com non 2505 ID804 - Bypassing the application won't do anything, we need to connect the digital EXE interface!
9+
<125>3 2025-03-25T08:17:17.736Z legacyrevolutionary.io laborum 6019 ID668 - I'Ll navigate the back-end CSS card, that should sensor the SCSI sensor!
10+
<183>2 2025-03-25T08:17:17.736Z investorcollaborative.io corporis 8613 ID483 - If we index the matrix, we can get to the JSON feed through the digital SAS firewall!
11+
<29>2 2025-03-25T08:17:17.736Z customerbricks-and-clicks.net est 5235 ID312 - The FTP protocol is down, input the 1080p driver so we can parse the XSS panel!
12+
<106>1 2025-03-25T08:17:17.736Z senior24/365.net laboriosam 4788 ID248 - The JSON bus is down, compress the solid state monitor so we can compress the SMTP capacitor!
13+
<46>1 2025-03-25T08:17:17.736Z dynamicnetworks.biz atque 9002 ID681 - You can't calculate the program without quantifying the auxiliary PNG panel!
14+
<56>3 2025-03-25T08:17:17.736Z principalexpedite.name aut 4052 ID616 - Use the 1080p IB hard drive, then you can navigate the multi-byte pixel!
15+
<189>3 2025-03-25T08:17:17.736Z corporatesolutions.org consequatur 984 ID302 - You can't generate the interface without compressing the optical AI matrix!
16+
<93>1 2025-03-25T08:17:17.736Z directcontent.info unde 8072 ID835 - You can't parse the feed without copying the primary THX microchip!
17+
<142>1 2025-03-25T08:17:17.736Z corporate24/365.com et 3530 ID326 - Use the 1080p COM sensor, then you can bypass the bluetooth matrix!
18+
<13>3 2025-03-25T08:17:17.736Z nationale-markets.io sed 9414 ID605 - Indexing the port won't do anything, we need to override the multi-byte XML firewall!
19+
<183>3 2025-03-25T08:17:17.736Z humansticky.info placeat 1388 ID304 - Use the auxiliary JBOD bandwidth, then you can input the primary application!
20+
<99>2 2025-03-25T08:17:17.736Z corporateaction-items.org temporibus 5504 ID332 - Overriding the hard drive won't do anything, we need to index the mobile HDD driver!

dev-tools/mage/downloads/utils_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
package downloads
66

77
import (
8+
"fmt"
9+
"net/http"
10+
"net/http/httptest"
811
"os"
912
"path/filepath"
1013
"testing"
@@ -13,10 +16,15 @@ import (
1316
)
1417

1518
func TestDownloadFile(t *testing.T) {
19+
s := httptest.NewServer(http.FileServer(http.Dir("./testdata")))
20+
t.Cleanup(s.Close)
21+
1622
var dRequest = downloadRequest{
17-
URL: "https://www.elastic.co/robots.txt",
23+
URL: fmt.Sprintf("http://%s/some-file.txt",
24+
s.Listener.Addr().String()),
1825
DownloadPath: "",
1926
}
27+
2028
err := downloadFile(&dRequest)
2129
assert.Nil(t, err)
2230
assert.NotEmpty(t, dRequest.UnsanitizedFilePath)

0 commit comments

Comments
 (0)