33import static org .junit .jupiter .api .Assertions .*;
44
55import com .databricks .sdk .core .DatabricksConfig ;
6+ import com .databricks .sdk .core .FixtureServer ;
67import com .databricks .sdk .core .HostType ;
78import com .databricks .sdk .service .provisioning .Workspace ;
9+ import java .io .IOException ;
810import org .junit .jupiter .api .Test ;
911
1012public class AccountClientTest {
@@ -31,30 +33,32 @@ public void testGetWorkspaceClientForTraditionalAccount() {
3133 }
3234
3335 @ Test
34- public void testGetWorkspaceClientForUnifiedHost () {
35- String unifiedHost = "https://unified.databricks.com" ;
36- DatabricksConfig accountConfig =
37- new DatabricksConfig ()
38- .setHost (unifiedHost )
39- .setAccountId ("test-account" )
40- .setToken ("test-token" );
36+ public void testGetWorkspaceClientForUnifiedHost () throws IOException {
37+ try (FixtureServer server = new FixtureServer ()) {
38+ String unifiedHost = server .getUrl ();
39+ DatabricksConfig accountConfig =
40+ new DatabricksConfig ()
41+ .setHost (unifiedHost )
42+ .setAccountId ("test-account" )
43+ .setToken ("test-token" );
4144
42- AccountClient accountClient = new AccountClient (accountConfig );
45+ AccountClient accountClient = new AccountClient (accountConfig );
4346
44- Workspace workspace = new Workspace ();
45- workspace .setWorkspaceId (123456L );
46- workspace .setDeploymentName ("test-workspace" );
47+ Workspace workspace = new Workspace ();
48+ workspace .setWorkspaceId (123456L );
49+ workspace .setDeploymentName ("test-workspace" );
4750
48- WorkspaceClient workspaceClient = accountClient .getWorkspaceClient (workspace );
51+ WorkspaceClient workspaceClient = accountClient .getWorkspaceClient (workspace );
4952
50- // Should have the same host (unified hosts reuse the same host )
51- assertEquals (unifiedHost , workspaceClient .config ().getHost ());
53+ // Should have the same host (non-matching DNS zone means SPOG path )
54+ assertEquals (unifiedHost , workspaceClient .config ().getHost ());
5255
53- // Should have workspace ID set
54- assertEquals ("123456" , workspaceClient .config ().getWorkspaceId ());
56+ // Should have workspace ID set
57+ assertEquals ("123456" , workspaceClient .config ().getWorkspaceId ());
5558
56- // Host type is WORKSPACE (determined from URL pattern, not unified flag)
57- assertEquals (HostType .WORKSPACE , workspaceClient .config ().getHostType ());
59+ // Host type is WORKSPACE (no resolved host type from metadata, URL doesn't match accounts pattern)
60+ assertEquals (HostType .WORKSPACE , workspaceClient .config ().getHostType ());
61+ }
5862 }
5963
6064 @ Test
0 commit comments