Parameterized the existing alpine based test with more registries.

Now we test alpine image from three registries:
1. docker hub.
2. quay.io.
3. alicloud.

Review: https://reviews.apache.org/r/58329/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d1015ffe
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d1015ffe
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d1015ffe

Branch: refs/heads/master
Commit: d1015ffe35dfcd353d7dbbd187244586feddd6a7
Parents: a2eaacb
Author: Gilbert Song <[email protected]>
Authored: Thu Apr 13 09:26:00 2017 -0700
Committer: Jie Yu <[email protected]>
Committed: Thu Apr 13 09:26:00 2017 -0700

----------------------------------------------------------------------
 .../containerizer/provisioner_docker_tests.cpp  | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d1015ffe/src/tests/containerizer/provisioner_docker_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/provisioner_docker_tests.cpp 
b/src/tests/containerizer/provisioner_docker_tests.cpp
index dbbc353..4dbd911 100644
--- a/src/tests/containerizer/provisioner_docker_tests.cpp
+++ b/src/tests/containerizer/provisioner_docker_tests.cpp
@@ -368,7 +368,9 @@ TEST_F(ProvisionerDockerLocalStoreTest, 
PullingSameImageSimutanuously)
 
 
 #ifdef __linux__
-class ProvisionerDockerPullerTest : public MesosTest {};
+class ProvisionerDockerPullerTest
+  : public MesosTest,
+    public WithParamInterface<string> {};
 
 
 // This test verifies that local docker image can be pulled and
@@ -448,9 +450,22 @@ TEST_F(ProvisionerDockerPullerTest, 
ROOT_LocalPullerSimpleCommand)
 }
 
 
+// For official Docker images, users can omit the 'library/' prefix
+// when specifying the repository name (e.g., 'busybox'). The registry
+// puller normalize docker official images if necessary.
+INSTANTIATE_TEST_CASE_P(
+    ImageAlpine,
+    ProvisionerDockerPullerTest,
+    ::testing::ValuesIn(vector<string>({
+        "alpine", // Verifies the normalization of the Docker repository name.
+        "library/alpine",
+        "quay.io/coreos/alpine-sh",
+        "registry.cn-hangzhou.aliyuncs.com/acs-sample/alpine"})));
+
+
 // TODO(jieyu): This is a ROOT test because of MESOS-4757. Remove the
 // ROOT restriction after MESOS-4757 is resolved.
-TEST_F(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_SimpleCommand)
+TEST_P(ProvisionerDockerPullerTest, ROOT_INTERNET_CURL_SimpleCommand)
 {
   Try<Owned<cluster::Master>> master = StartMaster();
   ASSERT_SOME(master);
@@ -498,7 +513,7 @@ TEST_F(ProvisionerDockerPullerTest, 
ROOT_INTERNET_CURL_SimpleCommand)
 
   Image image;
   image.set_type(Image::DOCKER);
-  image.mutable_docker()->set_name("library/alpine");
+  image.mutable_docker()->set_name(GetParam());
 
   ContainerInfo* container = task.mutable_container();
   container->set_type(ContainerInfo::MESOS);

Reply via email to