Ejemplo n.º 1
0
// Fetches the image manifest and all blobs in that image.
TEST_F(DockerFetcherPluginTest, INTERNET_CURL_FetchImage)
{
  URI uri = uri::docker::image(
      "library/busybox",
      "latest",
      DOCKER_REGISTRY_HOST);

  Try<Owned<uri::Fetcher>> fetcher = uri::fetcher::create();
  ASSERT_SOME(fetcher);

  string dir = path::join(os::getcwd(), "dir");

  AWAIT_READY_FOR(fetcher.get()->fetch(uri, dir), Seconds(60));

  Try<string> _manifest = os::read(path::join(dir, "manifest"));
  ASSERT_SOME(_manifest);

  Try<docker::spec::v2::ImageManifest> manifest =
    docker::spec::v2::parse(_manifest.get());

  ASSERT_SOME(manifest);
  EXPECT_EQ("library/busybox", manifest->name());
  EXPECT_EQ("latest", manifest->tag());

  for (int i = 0; i < manifest->fslayers_size(); i++) {
    EXPECT_TRUE(os::exists(path::join(dir, manifest->fslayers(i).blobsum())));
  }
}
Ejemplo n.º 2
0
TEST_F(DockerFetcherPluginTest, INTERNET_CURL_FetchManifest)
{
  URI uri = uri::docker::manifest(
      "library/busybox",
      "latest",
      DOCKER_REGISTRY_HOST);

  Try<Owned<uri::Fetcher>> fetcher = uri::fetcher::create();
  ASSERT_SOME(fetcher);

  string dir = path::join(os::getcwd(), "dir");

  AWAIT_READY(fetcher.get()->fetch(uri, dir));

  Try<string> _manifest = os::read(path::join(dir, "manifest"));
  ASSERT_SOME(_manifest);

  Try<docker::spec::v2::ImageManifest> manifest =
    docker::spec::v2::parse(_manifest.get());

  ASSERT_SOME(manifest);
  EXPECT_EQ("library/busybox", manifest->name());
  EXPECT_EQ("latest", manifest->tag());
}