Skip to content

Commit

Permalink
[custom] add core18 image (Fixes #602)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saviq committed May 8, 2019
1 parent c3f53a0 commit 3b93458
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/daemon/custom_image_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ const QMap<QString, CustomImageInfo> multipass_image_info{
"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
17 changes: 16 additions & 1 deletion tests/test_custom_image_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ TEST_F(CustomImageHost, returns_expected_data_for_core16)
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 @@ -118,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.

0 comments on commit 3b93458

Please sign in to comment.