mirror of https://github.com/docker/compose.git
add e2e tests to check build dependency between services
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
a9e070206e
commit
8c1e2af3e1
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright 2020 Docker Compose CLI authors
|
||||||
|
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
FROM busybox:1.35.0
|
||||||
|
RUN echo "hello"
|
|
@ -0,0 +1,9 @@
|
||||||
|
services:
|
||||||
|
foo:
|
||||||
|
image: built-image-dependency
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
bar:
|
||||||
|
image: built-image-dependency
|
||||||
|
depends_on:
|
||||||
|
- foo
|
|
@ -104,3 +104,22 @@ func TestUpDependenciesNotStopped(t *testing.T) {
|
||||||
RequireServiceState(t, c, "dependency", "running")
|
RequireServiceState(t, c, "dependency", "running")
|
||||||
RequireServiceState(t, c, "orphan", "running")
|
RequireServiceState(t, c, "orphan", "running")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUpWithBuildDependencies(t *testing.T) {
|
||||||
|
c := NewParallelCLI(t)
|
||||||
|
|
||||||
|
t.Run("up with service using image build by an another service", func(t *testing.T) {
|
||||||
|
// ensure local test run does not reuse previously build image
|
||||||
|
c.RunDockerOrExitError(t, "rmi", "built-image-dependency")
|
||||||
|
|
||||||
|
res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/dependencies",
|
||||||
|
"-f", "fixtures/dependencies/service-image-depends-on.yaml", "up", "-d")
|
||||||
|
|
||||||
|
t.Cleanup(func() {
|
||||||
|
c.RunDockerComposeCmd(t, "--project-directory", "fixtures/dependencies",
|
||||||
|
"-f", "fixtures/dependencies/service-image-depends-on.yaml", "down", "--rmi", "all")
|
||||||
|
})
|
||||||
|
|
||||||
|
res.Assert(t, icmd.Success)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue