File tree Expand file tree Collapse file tree
main/java/com/databricks/sdk/mixin
test/java/com/databricks/sdk Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77### Bug Fixes
88
9+ * Fixed ` selectSparkVersion() ` method to use contains() instead of equals() for spark version matching.
10+
911### Documentation
1012
1113### Internal Changes
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public String selectSparkVersion(SparkVersionSelector selector) throws IllegalAr
5050 matches = version .getName ().contains ("LTS" ) || version .getKey ().contains ("-esr-" );
5151 }
5252 if (matches && selector .sparkVersion != null ) {
53- matches = ( "Apache Spark " + selector .sparkVersion ). equals ( version . getName () );
53+ matches = version . getName (). contains ( "Apache Spark " + selector .sparkVersion );
5454 }
5555 if (matches ) {
5656 versions .add (version .getKey ());
Original file line number Diff line number Diff line change 11package com .databricks .sdk .integration ;
22
3+ import com .databricks .sdk .AccountClient ;
4+ import com .databricks .sdk .integration .framework .CollectionUtils ;
35import com .databricks .sdk .integration .framework .EnvContext ;
46import com .databricks .sdk .integration .framework .EnvTest ;
7+ import com .databricks .sdk .service .provisioning .CustomerManagedKey ;
8+ import org .junit .jupiter .api .Test ;
59import org .junit .jupiter .api .condition .DisabledIfEnvironmentVariable ;
610import org .junit .jupiter .api .extension .ExtendWith ;
711
812@ EnvContext ("account" )
913@ DisabledIfEnvironmentVariable (named = "ARM_CLIENT_ID" , matches = ".*" )
1014@ ExtendWith (EnvTest .class )
1115public class EncryptionKeysIT {
12- // TODO: Enable this test when the test account is updated to support this.
13- // Either by upgrading the test account tier to Enterprise or by adding this
14- // feature to the test account.
15- // @Test
16- // void lists(AccountClient a) {
17- // Iterable<CustomerManagedKey> list = a.encryptionKeys().list();
16+ @ Test
17+ void lists (AccountClient a ) {
18+ Iterable <CustomerManagedKey > list = a .encryptionKeys ().list ();
1819
19- // java.util.List<CustomerManagedKey> all = CollectionUtils.asList(list);
20+ java .util .List <CustomerManagedKey > all = CollectionUtils .asList (list );
2021
21- // CollectionUtils.assertUnique(all);
22- // }
22+ CollectionUtils .assertUnique (all );
23+ }
2324}
Original file line number Diff line number Diff line change @@ -118,4 +118,29 @@ void nullComparisonTest() {
118118 String nodeType = clustersExt .selectNodeType (new NodeTypeSelector ().withLocalDisk ());
119119 assertEquals ("testId1" , nodeType );
120120 }
121+
122+ private GetSparkVersionsResponse testGetSparkVersionsWithSparkVersion () {
123+ Collection <SparkVersion > versions = new ArrayList <>();
124+ // Mock realistic Databricks Runtime version based on actual API response format
125+ // The key point: version name contains more than just "Apache Spark X.Y.Z"
126+ versions .add (
127+ new SparkVersion ()
128+ .setName ("13.3 LTS (includes Apache Spark 3.4.1, Scala 2.12)" )
129+ .setKey ("13.3.x-scala2.12" ));
130+ return new GetSparkVersionsResponse ().setVersions (versions );
131+ }
132+
133+ @ Test
134+ void sparkVersionWithSparkVersionParameter () {
135+ ClustersExt clustersExt = new ClustersExt (clustersMock );
136+ Mockito .doReturn (testGetSparkVersionsWithSparkVersion ()).when (clustersMock ).sparkVersions ();
137+
138+ // Test that sparkVersion parameter works with realistic API response format
139+ // This tests the contains() fix - the version name is "13.3 LTS (includes Apache Spark 3.4.1,
140+ // Scala 2.12)"
141+ // not just "Apache Spark 3.4.1", so equals() would fail but contains() works
142+ String sparkVersion =
143+ clustersExt .selectSparkVersion (new SparkVersionSelector ().withSparkVersion ("3.4.1" ));
144+ assertEquals ("13.3.x-scala2.12" , sparkVersion );
145+ }
121146}
You can’t perform that action at this time.
0 commit comments