Repository: mesos Updated Branches: refs/heads/master 67017f136 -> 748a60e00
Changed ProvisionerAppcTest to use AppcStoreTest suite. This change will enable ProvisionerAppcTest suite to reuse common code like test image creation. Review: https://reviews.apache.org/r/42157/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/748a60e0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/748a60e0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/748a60e0 Branch: refs/heads/master Commit: 748a60e007c8760b13d0795e8f344231092f1666 Parents: 1ee4ee7 Author: Jojy Varghese <[email protected]> Authored: Mon Feb 8 15:12:15 2016 -0800 Committer: Jie Yu <[email protected]> Committed: Mon Feb 8 15:37:30 2016 -0800 ---------------------------------------------------------------------- .../containerizer/provisioner_appc_tests.cpp | 80 ++------------------ 1 file changed, 5 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/748a60e0/src/tests/containerizer/provisioner_appc_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/containerizer/provisioner_appc_tests.cpp b/src/tests/containerizer/provisioner_appc_tests.cpp index 2ebddbb..e0aa856 100644 --- a/src/tests/containerizer/provisioner_appc_tests.cpp +++ b/src/tests/containerizer/provisioner_appc_tests.cpp @@ -250,7 +250,7 @@ TEST_F(AppcStoreTest, Recover) } -class ProvisionerAppcTest : public TemporaryDirectoryTest {}; +class ProvisionerAppcTest : public AppcStoreTest {}; #ifdef __linux__ @@ -270,54 +270,9 @@ TEST_F(ProvisionerAppcTest, ROOT_Provision) Try<Owned<Provisioner>> provisioner = Provisioner::create(flags); ASSERT_SOME(provisioner); - // Create a simple image in the store: - // <store> - // |--images - // |--<id> - // |--manifest - // |--rootfs/tmp/test - JSON::Value manifest = JSON::parse( - "{" - " \"acKind\": \"ImageManifest\"," - " \"acVersion\": \"0.6.1\"," - " \"name\": \"foo.com/bar\"," - " \"labels\": [" - " {" - " \"name\": \"version\"," - " \"value\": \"1.0.0\"" - " }," - " {" - " \"name\": \"arch\"," - " \"value\": \"amd64\"" - " }," - " {" - " \"name\": \"os\"," - " \"value\": \"linux\"" - " }" - " ]," - " \"annotations\": [" - " {" - " \"name\": \"created\"," - " \"value\": \"1438983392\"" - " }" - " ]" - "}").get(); - - // The 'imageId' below has the correct format but it's not computed - // by hashing the tarball of the image. It's OK here as we assume - // the images under 'images' have passed such check when they are - // downloaded and validated. - string imageId = - "sha512-e77d96aa0240eedf134b8c90baeaf76dca8e78691836301d7498c84020446042e" - "797b296d6ab296e0954c2626bfb264322ebeb8f447dac4fac6511ea06bc61f0"; - - string imagePath = path::join(flags.appc_store_dir, "images", imageId); + Try<string> createImage = createTestImage(flags.appc_store_dir); - ASSERT_SOME(os::mkdir(path::join(imagePath, "rootfs", "tmp"))); - ASSERT_SOME( - os::write(path::join(imagePath, "rootfs", "tmp", "test"), "test")); - ASSERT_SOME( - os::write(path::join(imagePath, "manifest"), stringify(manifest))); + ASSERT_SOME(createImage); // Recover. This is when the image in the store is loaded. AWAIT_READY(provisioner.get()->recover({}, {})); @@ -381,34 +336,9 @@ TEST_F(ProvisionerAppcTest, Recover) Try<Owned<Provisioner>> provisioner1 = Provisioner::create(flags); ASSERT_SOME(provisioner1); - // Create a simple image in the store: - // <store> - // |--images - // |--<id> - // |--manifest - // |--rootfs/tmp/test - JSON::Value manifest = JSON::parse( - "{" - " \"acKind\": \"ImageManifest\"," - " \"acVersion\": \"0.6.1\"," - " \"name\": \"foo.com/bar\"" - "}").get(); + Try<string> createImage = createTestImage(flags.appc_store_dir); - // The 'imageId' below has the correct format but it's not computed - // by hashing the tarball of the image. It's OK here as we assume - // the images under 'images' have passed such check when they are - // downloaded and validated. - string imageId = - "sha512-e77d96aa0240eedf134b8c90baeaf76dca8e78691836301d7498c84020446042e" - "797b296d6ab296e0954c2626bfb264322ebeb8f447dac4fac6511ea06bc61f0"; - - string imagePath = path::join(flags.appc_store_dir, "images", imageId); - - ASSERT_SOME(os::mkdir(path::join(imagePath, "rootfs", "tmp"))); - ASSERT_SOME( - os::write(path::join(imagePath, "rootfs", "tmp", "test"), "test")); - ASSERT_SOME( - os::write(path::join(imagePath, "manifest"), stringify(manifest))); + ASSERT_SOME(createImage); // Recover. This is when the image in the store is loaded. AWAIT_READY(provisioner1.get()->recover({}, {}));
