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

[custom] add core18 image and core16 alias #771

Merged
merged 2 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion src/daemon/custom_image_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ struct CustomImageInfo
const QMap<QString, CustomImageInfo> multipass_image_info{
{{"ubuntu-core-16-amd64.img.xz"},
{"http://cdimage.ubuntu.com/ubuntu-core/16/stable/current/",
{"core"},
{"core", "core16"},
"Ubuntu",
"core-16",
"Core 16",
"",
""}},
{{"ubuntu-core-18-amd64.img.xz"},
{"http://cdimage.ubuntu.com/ubuntu-core/18/stable/current/",
{"core18"},
"Ubuntu",
"core-18",
"Core 18",
"",
""}}};

const QMap<QString, CustomImageInfo> snapcraft_image_info{
Expand Down
31 changes: 30 additions & 1 deletion tests/test_custom_image_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ TEST_F(CustomImageHost, returns_expected_data_for_core)
EXPECT_FALSE(info.version.isEmpty());
}

TEST_F(CustomImageHost, returns_expected_data_for_core16)
{
mp::CustomVMImageHost host{&url_downloader, default_ttl, test_path};

auto info = *host.info_for(make_query("core16", ""));

EXPECT_THAT(info.image_location, Eq(QUrl::fromLocalFile(test_path + "ubuntu-core-16-amd64.img.xz").toString()));
EXPECT_THAT(info.id, Eq(QString("934d52e4251537ee3bd8c500f212ae4c34992447e7d40d94f00bc7c21f72ceb7")));
EXPECT_THAT(info.release, Eq(QString("core-16")));
EXPECT_THAT(info.release_title, Eq(QString("Core 16")));
EXPECT_TRUE(info.supported);
EXPECT_FALSE(info.version.isEmpty());
}

TEST_F(CustomImageHost, returns_expected_data_for_core18)
{
mp::CustomVMImageHost host{&url_downloader, default_ttl, test_path};

auto info = *host.info_for(make_query("core18", ""));

EXPECT_THAT(info.image_location, Eq(QUrl::fromLocalFile(test_path + "ubuntu-core-18-amd64.img.xz").toString()));
EXPECT_THAT(info.id, Eq(QString("1ffea8a9caf5a4dcba4f73f9144cb4afe1e4fc1987f4ab43bed4c02fad9f087f")));
EXPECT_THAT(info.release, Eq(QString("core-18")));
EXPECT_THAT(info.release_title, Eq(QString("Core 18")));
EXPECT_TRUE(info.supported);
EXPECT_FALSE(info.version.isEmpty());
}

TEST_F(CustomImageHost, returns_expected_data_for_snapcraft_core)
{
mp::CustomVMImageHost host{&url_downloader, default_ttl, test_path};
Expand Down Expand Up @@ -104,10 +132,11 @@ TEST_F(CustomImageHost, iterates_over_all_entries)
auto action = [&ids](const std::string& remote, const mp::VMImageInfo& info) { ids.insert(info.id.toStdString()); };
host.for_each_entry_do(action);

const size_t expected_entries{3};
const size_t expected_entries{4};
EXPECT_THAT(ids.size(), Eq(expected_entries));

EXPECT_THAT(ids.count("934d52e4251537ee3bd8c500f212ae4c34992447e7d40d94f00bc7c21f72ceb7"), Eq(1u));
EXPECT_THAT(ids.count("1ffea8a9caf5a4dcba4f73f9144cb4afe1e4fc1987f4ab43bed4c02fad9f087f"), Eq(1u));
EXPECT_THAT(ids.count("a6e6db185f53763d9d6607b186f1e6ae2dc02f8da8ea25e58d92c0c0c6dc4e48"), Eq(1u));
EXPECT_THAT(ids.count("96107afaa1673577c91dfbe2905a823043face65be6e8a0edc82f6b932d8380c"), Eq(1u));
}
Expand Down
1 change: 1 addition & 0 deletions tests/test_data/custom/SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
934d52e4251537ee3bd8c500f212ae4c34992447e7d40d94f00bc7c21f72ceb7 *ubuntu-core-16-amd64.img.xz
1ffea8a9caf5a4dcba4f73f9144cb4afe1e4fc1987f4ab43bed4c02fad9f087f *ubuntu-core-18-amd64.img.xz
a6e6db185f53763d9d6607b186f1e6ae2dc02f8da8ea25e58d92c0c0c6dc4e48 ubuntu-16.04-minimal-cloudimg-amd64-disk1.img
96107afaa1673577c91dfbe2905a823043face65be6e8a0edc82f6b932d8380c ubuntu-18.04-minimal-cloudimg-amd64.img
Empty file.