Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 9d1a4b8

Browse files
committed
chore: add a test for the downloadFile method
1 parent c509c96 commit 9d1a4b8

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

e2e/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/onsi/ginkgo v1.10.1 // indirect
1212
github.com/onsi/gomega v1.7.0 // indirect
1313
github.com/sirupsen/logrus v1.4.2
14+
github.com/stretchr/testify v1.5.1
1415
)
1516

1617
replace github.com/testcontainers/testcontainers-go v0.0.8 => github.com/mdelapenya/testcontainers-go v0.0.9-compose-1

e2e/utils_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package e2e
2+
3+
import (
4+
"os"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
func TestDownloadFile(t *testing.T) {
11+
configurationFileURL := "https://raw.githubusercontent.com/elastic/beats/v7.6.0/metricbeat/metricbeat.yml"
12+
13+
configurationFilePath, err := downloadFile(configurationFileURL)
14+
if err != nil {
15+
t.Fail()
16+
}
17+
18+
info, err := os.Stat(configurationFilePath)
19+
if os.IsNotExist(err) {
20+
t.Fail()
21+
}
22+
23+
assert.False(t, info.IsDir())
24+
assert.Equal(t, "metricbeat.yml", info.Name())
25+
}

0 commit comments

Comments
 (0)