Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update adapter version messages #10919

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241025-104339.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: update adapter version messages
time: 2024-10-25T10:43:39.274723-05:00
custom:
Author: dave-connors-3
Issue: "10230"
6 changes: 5 additions & 1 deletion core/dbt/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ def _get_plugin_msg_info(

needs_update = False

if plugin.major != core.major or plugin.minor != core.minor:
assert plugin.major is not None
MichelleArk marked this conversation as resolved.
Show resolved Hide resolved
assert plugin.minor is not None
assert core.major is not None
assert core.minor is not None
if plugin.major != core.major or plugin.minor < core.minor:
MichelleArk marked this conversation as resolved.
Show resolved Hide resolved
compatibility_msg = red("Not compatible!")
needs_update = True
return (compatibility_msg, needs_update)
Expand Down
93 changes: 93 additions & 0 deletions tests/unit/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,99 @@ def test_plugin_diff_core_minor_ahead_latest(self, mocker):

assert expected == actual

def test_plugin_diff_plugin_minor_ahead_latest(self, mocker):
"""
Now that adapters are decoupled from core, a higher minor version of a plugin
is compatible with a lower minor version of core.
"""

mock_versions(
mocker,
installed="1.8.0",
latest="1.8.0",
plugins={
"foobar": ("1.9.0", "1.9.0"),
},
)

actual = dbt.version.get_version_information()
expected = "\n".join(
[
"Core:",
" - installed: 1.8.0",
f" - latest: 1.8.0 - {green('Up to date!')}",
"",
"Plugins:",
f" - foobar: 1.9.0 - {green('Up to date!')}",
"",
"",
]
)

assert expected == actual

def test_plugin_diff_plugin_patch_ahead_latest(self, mocker):
"""
Now that adapters are decoupled from core, a higher minor version of a plugin
is compatible with a lower minor version of core.
"""

mock_versions(
mocker,
installed="1.8.0",
latest="1.8.0",
plugins={
"foobar": ("1.8.4", "1.8.4"),
},
)

actual = dbt.version.get_version_information()
expected = "\n".join(
[
"Core:",
" - installed: 1.8.0",
f" - latest: 1.8.0 - {green('Up to date!')}",
"",
"Plugins:",
f" - foobar: 1.8.4 - {green('Up to date!')}",
"",
"",
]
)

assert expected == actual

def test_plugin_diff_plugin_minor_ahead_no_latest(self, mocker):
"""
Now that adapters are decoupled from core, a higher minor version of a plugin
is compatible with a lower minor version of core.
"""

mock_versions(
mocker,
installed="1.8.0",
latest="1.8.0",
plugins={
"foobar": ("1.9.0", None),
},
)

actual = dbt.version.get_version_information()
expected = "\n".join(
[
"Core:",
" - installed: 1.8.0",
f" - latest: 1.8.0 - {green('Up to date!')}",
"",
"Plugins:",
f" - foobar: 1.9.0 - {yellow('Could not determine latest version')}",
"",
"",
]
)

assert expected == actual

def test_plugin_diff_core_minor_behind_latest(self, mocker):
mock_versions(
mocker,
Expand Down
Loading