Skip to content

Commit 5a4f31d

Browse files
authored
Run integration tests on the CI (#296)
* removed redundant test * add python tests * un-mark as integration * additional step to run integration tests * change step name * install dependencies first * split unit and intg tests execution * bump image for all steps
1 parent 15fcf19 commit 5a4f31d

File tree

4 files changed

+17
-39
lines changed

4 files changed

+17
-39
lines changed

.drone.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,36 @@ name: default
33

44
steps:
55
- name: lint
6-
image: arduino/arduino-cli:drone-0.2.0
6+
image: arduino/arduino-cli:drone-1.0
77
commands:
88
# Check if the Go code is properly formatted and run the linter
99
- task check
1010
# Ensure protobufs compile
1111
- task protoc
1212

1313
- name: build
14-
image: arduino/arduino-cli:drone-0.2.0
14+
image: arduino/arduino-cli:drone-1.0
1515
commands:
1616
- task build
1717

1818
- name: test
19-
image: arduino/arduino-cli:drone-0.2.0
19+
image: arduino/arduino-cli:drone-1.0
2020
commands:
21-
- task test
21+
- task test-unit
2222
- task test-legacy
2323

24+
- name: integration
25+
image: arduino/arduino-cli:drone-1.0
26+
failure: ignore # work in progress, we know some tests will fail at the moment
27+
commands:
28+
- pip install -r test/requirements.txt
29+
- task test-integration
30+
2431
# Contrary to other CI platforms, uploading reports to Codecov requires Drone to provide a token.
2532
# To avoid exposing the Codecov token to external PRs, we only upload coverage when we merge on
2633
# `master`.
2734
- name: coverage
28-
image: arduino/arduino-cli:drone-0.2.0
35+
image: arduino/arduino-cli:drone-1.0
2936
environment:
3037
CODECOV_TOKEN:
3138
from_secret: codecov_token

Taskfile.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ tasks:
2020
test-unit:
2121
desc: Run unit tests only
2222
cmds:
23-
- go test -short {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }}
23+
- go test -short {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }} {{.TEST_LDFLAGS}}
2424

2525
test-integration:
2626
desc: Run integration tests only
2727
cmds:
2828
- go test -run Integration {{ default "-v" .GOFLAGS }} -coverprofile=coverage_integ.txt {{ default .DEFAULT_TARGETS .TARGETS }} {{.TEST_LDFLAGS}}
29+
- pytest test/
2930

3031
test-legacy:
3132
desc: Run tests for the `legacy` package

cli/cli_test.go

-27
Original file line numberDiff line numberDiff line change
@@ -288,33 +288,6 @@ func TestUploadIntegration(t *testing.T) {
288288
require.NotZero(t, exitCode)
289289
}
290290

291-
func TestLibSearchIntegration(t *testing.T) {
292-
exitCode, output := executeWithArgs("lib", "search", "audiozer", "--format", "json")
293-
require.Zero(t, exitCode)
294-
var res struct {
295-
Libraries []struct {
296-
Name string
297-
}
298-
}
299-
err := json.Unmarshal(output, &res)
300-
require.NoError(t, err, "decoding json output")
301-
require.NotNil(t, res.Libraries)
302-
require.Len(t, res.Libraries, 1)
303-
require.Equal(t, res.Libraries[0].Name, "AudioZero")
304-
305-
exitCode, output = executeWithArgs("lib", "search", "audiozero", "--names")
306-
require.Zero(t, exitCode, "process exit code")
307-
require.Equal(t, "AudioZero\n", string(output))
308-
309-
exitCode, output = executeWithArgs("lib", "search", "audiozer", "--names")
310-
require.Zero(t, exitCode, "process exit code")
311-
require.Equal(t, "AudioZero\n", string(output))
312-
313-
exitCode, output = executeWithArgs("lib", "search", "audiozerooooo", "--names")
314-
require.Zero(t, exitCode, "process exit code")
315-
require.Equal(t, "", string(output))
316-
}
317-
318291
func TestLibUserIntegration(t *testing.T) {
319292
// source of test custom libs
320293
libDir := filepath.Join("testdata", "libs")

version/version_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@ import (
2424
"github.com/stretchr/testify/require"
2525
)
2626

27-
// TestIntegrationBuildInjectedInfo is an integration test that aims to test the Info strings passed to the binary at build time
27+
// TestBuildInjectedInfo tests the Info strings passed to the binary at build time
2828
// in order to have this test green launch your testing using the provided task (see /Taskfile.yml) or use:
29-
// go test -run Integration -v ./... -ldflags '
29+
// go test -run TestBuildInjectedInfo -v ./... -ldflags '
3030
// -X github.com/arduino/arduino-cli/version.versionString=0.0.0-test.preview
3131
// -X github.com/arduino/arduino-cli/version.commit=deadbeef'
32-
func TestIntegrationBuildInjectedInfo(t *testing.T) {
33-
if testing.Short() {
34-
t.Skip("skip integration test")
35-
}
32+
func TestBuildInjectedInfo(t *testing.T) {
3633
goldenAppName := "arduino-cli"
3734
goldenInfo := Info{
3835
Application: goldenAppName,

0 commit comments

Comments
 (0)