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

[daemon/find] Filter out snapcraft remote by default #3327

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,8 @@ try // clang-format on
std::unordered_set<std::string> images_found;
auto action = [&images_found, &default_remote, request, &response](const std::string& remote,
const mp::VMImageInfo& info) {
if ((info.supported || request->allow_unsupported()) && !info.aliases.empty() &&
if (!(remote == mp::snapcraft_remote) && (info.supported || request->allow_unsupported()) &&
townsend2010 marked this conversation as resolved.
Show resolved Hide resolved
!info.aliases.empty() &&
images_found.find(info.release_title.toStdString()) == images_found.end())
{
add_aliases(response.mutable_images_info(), remote, info, default_remote);
Expand Down
8 changes: 5 additions & 3 deletions tests/test_daemon_find.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ TEST_F(DaemonFind, blankQueryReturnsAllData)

EXPECT_THAT(stream.str(), AllOf(HasSubstr(mpt::default_alias), HasSubstr(mpt::default_release_info),
HasSubstr(mpt::another_alias), HasSubstr(mpt::another_release_info),
HasSubstr(fmt::format("{}:{}", mpt::snapcraft_remote, mpt::snapcraft_alias)),
HasSubstr(mpt::snapcraft_release_info),
HasSubstr(fmt::format("{}:{}", mpt::custom_remote, mpt::custom_alias)),
HasSubstr(mpt::custom_release_info), HasSubstr(blueprint1_name),
HasSubstr(blueprint_description_for(blueprint1_name)), HasSubstr(blueprint2_name),
HasSubstr(blueprint_description_for(blueprint2_name))));

EXPECT_EQ(total_lines_of_output(stream), 10);
EXPECT_THAT(stream.str(),
Not(AllOf(HasSubstr(fmt::format("{}:{}", mpt::snapcraft_remote, mpt::snapcraft_alias)),
HasSubstr(mpt::snapcraft_release_info))));

EXPECT_EQ(total_lines_of_output(stream), 9);
}

TEST_F(DaemonFind, queryForDefaultReturnsExpectedData)
Expand Down