From 3512eaea0839b366ba3cb99c0d6d26957faa5de6 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 10:22:10 +0200 Subject: [PATCH 1/8] removed redundant test --- cli/cli_test.go | 27 --------------------------- 1 file changed, 27 deletions(-) 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") From 486b639c90283088bca89040faa62da54272c86d Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 11:45:53 +0200 Subject: [PATCH 2/8] add python tests --- Taskfile.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From a2fb07dd085faf49b79ddd9ff1ec7cd9932589f4 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 11:46:04 +0200 Subject: [PATCH 3/8] un-mark as integration --- version/version_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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, From 7f6bb330256bc19532e0a7bb3cdfbdb675c6b9ca Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 11:46:19 +0200 Subject: [PATCH 4/8] additional step to run integration tests --- .drone.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 24a8305ae87..3c4125ce875 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 @@ -21,6 +21,12 @@ steps: - task test - task test-legacy +- name: test + image: arduino/arduino-cli:drone-0.2.0 + failure: ignore # work in progress, we know some tests will fail at the moment + commands: + - 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`. From 9ace365fff4b3147e28b1a20933bda3fe2043cb0 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 11:51:56 +0200 Subject: [PATCH 5/8] change step name --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 3c4125ce875..3733a8bcbd1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: - task test - task test-legacy -- name: test +- name: integration image: arduino/arduino-cli:drone-0.2.0 failure: ignore # work in progress, we know some tests will fail at the moment commands: From e3621e552ba50f604b548391def6f6662151830a Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 12:22:20 +0200 Subject: [PATCH 6/8] install dependencies first --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 3733a8bcbd1..ab826dba96b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,6 +25,7 @@ steps: image: arduino/arduino-cli:drone-0.2.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. From 64efe5e3d721c25d9cd4bb629a2a3b925f833663 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 12:29:42 +0200 Subject: [PATCH 7/8] split unit and intg tests execution --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index ab826dba96b..5360500b568 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,7 +18,7 @@ steps: - name: test image: arduino/arduino-cli:drone-0.2.0 commands: - - task test + - task test-unit - task test-legacy - name: integration From 1323e94d4e9da6fd0206c9f781948a650fa7cc14 Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 22 Jul 2019 12:37:42 +0200 Subject: [PATCH 8/8] bump image for all steps --- .drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5360500b568..9c7df4ebe1c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,18 +11,18 @@ 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-unit - task test-legacy - name: integration - image: arduino/arduino-cli:drone-0.2.0 + 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 @@ -32,7 +32,7 @@ steps: # 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