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
Changes from 1 commit
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
Next Next commit
update tests for mismatching plugins
  • Loading branch information
dave-connors-3 committed Oct 25, 2024
commit f7d3cc4ae77513a9294fa96fad720641a3e4ecef
6 changes: 5 additions & 1 deletion core/dbt/version.py
Original file line number Diff line number Diff line change
@@ -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)
62 changes: 62 additions & 0 deletions tests/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -489,6 +489,68 @@ 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_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,