Skip to content

Run integration tests on the CI #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -3,29 +3,36 @@ name: default

steps:
- name: lint
image: arduino/arduino-cli:drone-0.2.0
image: arduino/arduino-cli:drone-1.0
commands:
# Check if the Go code is properly formatted and run the linter
- task check
# Ensure protobufs compile
- task protoc

- name: build
image: arduino/arduino-cli:drone-0.2.0
image: arduino/arduino-cli:drone-1.0
commands:
- task build

- name: test
image: arduino/arduino-cli:drone-0.2.0
image: arduino/arduino-cli:drone-1.0
commands:
- task test
- task test-unit
- task test-legacy

- name: integration
image: arduino/arduino-cli:drone-1.0
failure: ignore # work in progress, we know some tests will fail at the moment
commands:
- pip install -r test/requirements.txt
- task test-integration

# Contrary to other CI platforms, uploading reports to Codecov requires Drone to provide a token.
# To avoid exposing the Codecov token to external PRs, we only upload coverage when we merge on
# `master`.
- name: coverage
image: arduino/arduino-cli:drone-0.2.0
image: arduino/arduino-cli:drone-1.0
environment:
CODECOV_TOKEN:
from_secret: codecov_token
3 changes: 2 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
@@ -20,12 +20,13 @@ tasks:
test-unit:
desc: Run unit tests only
cmds:
- go test -short {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }}
- go test -short {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }} {{.TEST_LDFLAGS}}

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

test-legacy:
desc: Run tests for the `legacy` package
27 changes: 0 additions & 27 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
@@ -288,33 +288,6 @@ func TestUploadIntegration(t *testing.T) {
require.NotZero(t, exitCode)
}

func TestLibSearchIntegration(t *testing.T) {
exitCode, output := executeWithArgs("lib", "search", "audiozer", "--format", "json")
require.Zero(t, exitCode)
var res struct {
Libraries []struct {
Name string
}
}
err := json.Unmarshal(output, &res)
require.NoError(t, err, "decoding json output")
require.NotNil(t, res.Libraries)
require.Len(t, res.Libraries, 1)
require.Equal(t, res.Libraries[0].Name, "AudioZero")

exitCode, output = executeWithArgs("lib", "search", "audiozero", "--names")
require.Zero(t, exitCode, "process exit code")
require.Equal(t, "AudioZero\n", string(output))

exitCode, output = executeWithArgs("lib", "search", "audiozer", "--names")
require.Zero(t, exitCode, "process exit code")
require.Equal(t, "AudioZero\n", string(output))

exitCode, output = executeWithArgs("lib", "search", "audiozerooooo", "--names")
require.Zero(t, exitCode, "process exit code")
require.Equal(t, "", string(output))
}

func TestLibUserIntegration(t *testing.T) {
// source of test custom libs
libDir := filepath.Join("testdata", "libs")
9 changes: 3 additions & 6 deletions version/version_test.go
Original file line number Diff line number Diff line change
@@ -24,15 +24,12 @@ import (
"github.com/stretchr/testify/require"
)

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