Exemplo n.º 1
0
    def test_when_a_component_is_implemented_by_a_docker_file(self):
        model = Model(
            [
                Component("server",
                          provided_services=[Service("Awesome")],
                          required_features=[Feature("JDK")],
                          implementation=DockerFile("server/Dockerfile")),
                Component("jdk",
                          provided_features=[Feature("JDK")],
                          implementation=DockerFile("jdk/Dockerfile"))

            ],
            Goals(services=[Service("Awesome")])
        )

        server_0 = Instance("server_0", model.resolve("server"))
        jdk_0 = Instance("jdk_0", model.resolve("jdk"))

        server_0.feature_provider = jdk_0
        configuration = Configuration(model, [server_0, jdk_0])

        self.build(configuration)

        self.assert_generated(
            "config_0/images/build_images.sh",
             with_patterns=[
                 "docker build -t camp-server_0 ./server",
                 "docker build -t camp-jdk_0 ./jdk_0"
                 ])
Exemplo n.º 2
0
    def test_when_a_component_host_is_implemented_by_a_docker_image(self):
        model = Model(
            [
                Component("server",
                          provided_services=[Service("Awesome")],
                          required_features=[Feature("JDK")],
                          implementation=DockerFile("server/Dockerfile")),
                Component("jdk",
                          provided_features=[Feature("JDK")],
                          implementation=DockerImage("fchauvel/test:1.0.1")),
            ],
            Goals(services=[Service("Awesome")])
        )

        server_0 = Instance("server_0", model.resolve("server"))
        jdk_0 = Instance("jdk_0", model.resolve("jdk"))
        server_0.feature_provider = jdk_0

        configuration = Configuration( model, [ server_0,
                                                jdk_0 ])
        self.build(configuration)

        self.assert_generated(
            "config_0/images/server_0/Dockerfile",
            with_patterns=[
                "FROM fchauvel/test:1.0.1"
            ])