diff --git a/.drone.yml b/.drone.yml index 24a8305ae87..9c7df4ebe1c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,7 +3,7 @@ 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 @@ -11,21 +11,28 @@ steps: - 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 diff --git a/Taskfile.yml b/Taskfile.yml index ed04c7d9cb0..04c4c2f9ac2 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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 diff --git a/cli/cli_test.go b/cli/cli_test.go index 50efa732953..b0a468f555a 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -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") diff --git a/version/version_test.go b/version/version_test.go index 7d5aae1a1d1..dc0552e80cf 100644 --- a/version/version_test.go +++ b/version/version_test.go @@ -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,