Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 26 additions & 0 deletions acceptance/bundle/deploy/spark-jar-task/databricks.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
bundle:
name: spark-jar-task-$UNIQUE_NAME

artifacts:
my_java_code:
path: ./myjar
build: "javac PrintArgs.java && jar cvfm PrintArgs.jar META-INF/MANIFEST.MF PrintArgs.class"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question - do we specifically want to test javac there or can we add a jar directly and then remove JDK requirement from our test suite and github workflows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to make sure here that building with artifacts section actually works, that it produce the artifacts which we can later correctly reference on

files:
- source: ./myjar/PrintArgs.jar

resources:
jobs:
jar_job:
name: "[${bundle.target}] Test Spark Jar Job $UNIQUE_NAME"
tasks:
- task_key: TestSparkJarTask
new_cluster:
num_workers: 1
spark_version: 16.4.x-scala2.12
node_type_id: $NODE_TYPE_ID
instance_pool_id: $TEST_INSTANCE_POOL_ID
data_security_mode: NONE
spark_jar_task:
main_class_name: PrintArgs
libraries:
- jar: ./myjar/PrintArgs.jar
3 changes: 3 additions & 0 deletions acceptance/bundle/deploy/spark-jar-task/out.test.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions acceptance/bundle/deploy/spark-jar-task/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

>>> [CLI] bundle deploy
Building my_java_code...
Uploading myjar/PrintArgs.jar...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/spark-jar-task-[UNIQUE_NAME]/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> [CLI] bundle run jar_job
Run URL: [DATABRICKS_URL]/?o=[NUMID]#job/[NUMID]/run/[NUMID]

[TIMESTAMP] "[default] Test Spark Jar Job [UNIQUE_NAME]" RUNNING
[TIMESTAMP] "[default] Test Spark Jar Job [UNIQUE_NAME]" TERMINATED SUCCESS
Hello from Jar!
[]
>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.jobs.jar_job

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/spark-jar-task-[UNIQUE_NAME]/default

Deleting files...
Destroy complete!
4 changes: 4 additions & 0 deletions acceptance/bundle/deploy/spark-jar-task/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
envsubst < databricks.yml.tmpl > databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy
trace $CLI bundle run jar_job
17 changes: 17 additions & 0 deletions acceptance/bundle/deploy/spark-jar-task/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Local = true
Cloud = true
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"]

Ignore = [
'myjar/PrintArgs.jar',
'myjar/PrintArgs.class',
]

[[Server]]
Pattern = "GET /api/2.2/jobs/runs/get-output"
Response.Body = '''
{
"run_id": 1234567890,
"logs": "Hello from Jar!\n[]"
}
'''

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions integration/bundle/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ func deployBundle(t testutil.TestingT, ctx context.Context, path string) {
require.NoError(t, err)
}

func runResource(t testutil.TestingT, ctx context.Context, path, key string) (string, error) {
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
c := testcli.NewRunner(t, ctx, "bundle", "run", key)
stdout, _, err := c.Run()
return stdout.String(), err
}

func destroyBundle(t testutil.TestingT, ctx context.Context, path string) {
ctx = env.Set(ctx, "BUNDLE_ROOT", path)
c := testcli.NewRunner(t, ctx, "bundle", "destroy", "--auto-approve")
Expand Down
156 changes: 0 additions & 156 deletions integration/bundle/spark_jar_test.go

This file was deleted.

29 changes: 0 additions & 29 deletions integration/internal/acc/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/databricks/cli/internal/testutil"
"github.com/databricks/cli/libs/env"
"github.com/databricks/databricks-sdk-go"
"github.com/databricks/databricks-sdk-go/service/compute"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -40,34 +39,6 @@ func WorkspaceTest(t testutil.TestingT) (context.Context, *WorkspaceT) {
return wt.ctx, wt
}

// Run the workspace test only on UC workspaces.
func UcWorkspaceTest(t testutil.TestingT) (context.Context, *WorkspaceT) {
t.Helper()
testutil.LoadDebugEnvIfRunFromIDE(t, "workspace")

t.Logf("CLOUD_ENV=%s", testutil.GetEnvOrSkipTest(t, "CLOUD_ENV"))

if env.Get(t.Context(), "TEST_METASTORE_ID") == "" {
t.Skipf("Skipping on non-UC workspaces")
}
if env.Get(t.Context(), "DATABRICKS_ACCOUNT_ID") != "" {
t.Skipf("Skipping on accounts")
}

w, err := databricks.NewWorkspaceClient()
require.NoError(t, err)

wt := &WorkspaceT{
TestingT: t,

W: w,

ctx: t.Context(),
}

return wt.ctx, wt
}

func (t *WorkspaceT) TestClusterID() string {
t.Helper()
clusterID := testutil.GetEnvOrSkipTest(t, "TEST_BRICKS_CLUSTER_ID")
Expand Down
Loading
Loading