Skip to content

Commit 019952c

Browse files
committed
Remove redundant resolveHostMetadata() calls from tests
resolve() internally calls tryResolveHostMetadata() which already populates resolvedHostType. Remove the redundant explicit calls and revert to single fixtures, except for testResolveHostMetadataDoesNotOverwriteExistingHostType which genuinely needs a second call to verify no-overwrite behavior.
1 parent 4ec3b95 commit 019952c

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

databricks-sdk-java/src/test/java/com/databricks/sdk/core/DatabricksConfigTest.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,9 @@ public void testResolveHostMetadataPopulatesResolvedHostType() throws IOExceptio
668668
+ "\","
669669
+ "\"host_type\":\"workspace\"}";
670670
try (FixtureServer server =
671-
new FixtureServer()
672-
.with("GET", "/.well-known/databricks-config", response, 200)
673-
.with("GET", "/.well-known/databricks-config", response, 200)) {
671+
new FixtureServer().with("GET", "/.well-known/databricks-config", response, 200)) {
674672
DatabricksConfig config = new DatabricksConfig().setHost(server.getUrl());
675673
config.resolve(emptyEnv());
676-
config.resolveHostMetadata();
677674
assertEquals(HostType.WORKSPACE, config.getResolvedHostType());
678675
}
679676
}
@@ -707,12 +704,9 @@ public void testResolveHostMetadataUnknownHostTypeIgnored() throws IOException {
707704
+ "\","
708705
+ "\"host_type\":\"unknown_value\"}";
709706
try (FixtureServer server =
710-
new FixtureServer()
711-
.with("GET", "/.well-known/databricks-config", response, 200)
712-
.with("GET", "/.well-known/databricks-config", response, 200)) {
707+
new FixtureServer().with("GET", "/.well-known/databricks-config", response, 200)) {
713708
DatabricksConfig config = new DatabricksConfig().setHost(server.getUrl());
714709
config.resolve(emptyEnv());
715-
config.resolveHostMetadata();
716710
assertNull(config.getResolvedHostType());
717711
}
718712
}
@@ -726,12 +720,9 @@ public void testResolveHostMetadataHostTypeAccount() throws IOException {
726720
+ "\","
727721
+ "\"host_type\":\"account\"}";
728722
try (FixtureServer server =
729-
new FixtureServer()
730-
.with("GET", "/.well-known/databricks-config", response, 200)
731-
.with("GET", "/.well-known/databricks-config", response, 200)) {
723+
new FixtureServer().with("GET", "/.well-known/databricks-config", response, 200)) {
732724
DatabricksConfig config = new DatabricksConfig().setHost(server.getUrl());
733725
config.resolve(emptyEnv());
734-
config.resolveHostMetadata();
735726
assertEquals(HostType.ACCOUNTS, config.getResolvedHostType());
736727
}
737728
}
@@ -745,12 +736,9 @@ public void testResolveHostMetadataHostTypeUnified() throws IOException {
745736
+ "\","
746737
+ "\"host_type\":\"unified\"}";
747738
try (FixtureServer server =
748-
new FixtureServer()
749-
.with("GET", "/.well-known/databricks-config", response, 200)
750-
.with("GET", "/.well-known/databricks-config", response, 200)) {
739+
new FixtureServer().with("GET", "/.well-known/databricks-config", response, 200)) {
751740
DatabricksConfig config = new DatabricksConfig().setHost(server.getUrl());
752741
config.resolve(emptyEnv());
753-
config.resolveHostMetadata();
754742
assertEquals(HostType.UNIFIED, config.getResolvedHostType());
755743
}
756744
}

0 commit comments

Comments
 (0)