Commit e068441
authored
[Internal] Use resolved host type from host metadata in HostType() (#1606)
## Summary
`HostType()` now returns the host type resolved from the
`/.well-known/databricks-config`
metadata endpoint when available, falling back to URL pattern matching
only when
metadata has not been resolved.
## Why
PR #1596 added `HostType` to the host metadata response and stores it in
`Config.resolvedHostType` during resolution. Adding support for the host
type metadata in HostType()
## What changed
### Interface changes
None. `HostType()` still returns `HostType` with the same possible
values.
### Behavioral changes
- **`HostType()` now returns all resolved host types** (`WorkspaceHost`,
`AccountHost`, `UnifiedHost`) from metadata when `resolvedHostType` is
not
`HostTypeUnknown`.
- The metadata check takes priority over **all** existing fallback
logic,
including the `Experimental_IsUnifiedHost` flag and URL pattern
matching.
- When metadata is unavailable, behavior is identical to before.
### Internal changes
- Added `resolvedHostType` check at the top of `HostType()` in
`config/config.go`.
- Updated docstring to reflect the new resolution order.
## How is this tested?
Added 7 new unit tests in `config/config_test.go`:
- Metadata workspace/account/unified types override URL patterns
- Falls back to URL matching when metadata is `HostTypeUnknown`
(workspace + account URLs)
- Metadata takes priority over `Experimental_IsUnifiedHost` flag
- End-to-end: `EnsureResolved()` with mocked metadata → `HostType()`
returns server value1 parent eedcd37 commit e068441
3 files changed
Lines changed: 82 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
451 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
452 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
453 | 463 | | |
454 | 464 | | |
455 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
88 | 157 | | |
89 | 158 | | |
90 | 159 | | |
| |||
0 commit comments