Skip to content

Commit c958702

Browse files
authored
Move integration tests to integration package (#2009)
## Changes Objectives: * A dedicated directory for integration tests * It is not picked up by `go test ./...` * No need for a `TestAcc` test name prefix * More granular packages to improve test selection (future) The tree structure generally mirrors the source code tree structure. Requirements for new files in this directory: * Every package **must** be named after its directory with `_test` appended * Requiring a different package name for integration tests avoids aliasing with the main package. * Every integration test package **must** include a `main_test.go` file. These requirements are enforced by a unit test in the `integration` package. ## Tests Integration tests pass. The total run time regresses by about 10%. A follow-up change that increases the degree of test parallelism will address this.
1 parent 61b0c59 commit c958702

File tree

145 files changed

+538
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+538
-52
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ vendor:
3737
@go mod vendor
3838

3939
integration:
40-
gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./internal/..." -- -run "TestAcc.*" -parallel 4 -timeout=2h
40+
gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./integration/..." -- -parallel 4 -timeout=2h
4141

4242
.PHONY: fmt lint lintcheck test testonly coverage build snapshot vendor integration

integration/README.md

Lines changed: 37 additions & 0 deletions

internal/dashboard_assumptions_test.go renamed to integration/assumptions/dashboard_assumptions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package internal
1+
package assumptions_test
22

33
import (
44
"encoding/base64"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package assumptions_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/databricks/cli/integration/internal"
7+
)
8+
9+
// TestMain is the entrypoint executed by the test runner.
10+
// See [internal.Main] for prerequisites for running integration tests.
11+
func TestMain(m *testing.M) {
12+
internal.Main(m)
13+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package bundle
1+
package bundle_test
22

33
import (
44
"fmt"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package bundle
1+
package bundle_test
22

33
import (
44
"os"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package bundle
1+
package bundle_test
22

33
import (
44
"fmt"

internal/bundle/bundles/artifact_path_with_volume/databricks_template_schema.json renamed to integration/bundle/bundles/artifact_path_with_volume/databricks_template_schema.json

File renamed without changes.

internal/bundle/bundles/artifact_path_with_volume/template/databricks.yml.tmpl renamed to integration/bundle/bundles/artifact_path_with_volume/template/databricks.yml.tmpl

File renamed without changes.

internal/bundle/bundles/basic/databricks_template_schema.json renamed to integration/bundle/bundles/basic/databricks_template_schema.json

File renamed without changes.

0 commit comments

Comments
 (0)