Skip to content

Commit

Permalink
test: add test case with postgres service
Browse files Browse the repository at this point in the history
Signed-off-by: Emilien Escalle <[email protected]>
  • Loading branch information
neilime committed Jan 30, 2025
1 parent 765986d commit 52ccee8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/__check-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,22 @@ jobs:
echo "Docker compose version is not in $DOCKER_COMPOSE_VERSION version"
exit 1
fi
test-action-with-postgres-service:
runs-on: ubuntu-latest
name: Test with postgres service
steps:
- uses: actions/checkout@v4

- name: Act
uses: ./
with:
compose-file: "./test/docker-compose-postgres.yml"
up-flags: "--quiet-pull"
down-flags: "--timeout 5"

- name: "Assert: postgres service is running"
run: |
docker compose -f ./test/docker-compose.yml ps
docker compose -f ./test/docker-compose.yml ps | grep test-service-postgres || (echo "Service test-service-postgres is not running" && exit 1)
1 change: 0 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion dist/post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/services/docker-compose.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe("DockerComposeService", () => {
composeOptions: [],
commandOptions: [],
config: ["docker-compose.yml"],
log: true,
cwd: "/current/working/dir",
});
});
Expand All @@ -58,7 +57,6 @@ describe("DockerComposeService", () => {
composeOptions: [],
commandOptions: ["--build"],
config: ["docker-compose.yml"],
log: true,
cwd: "/current/working/dir",
});
});
Expand All @@ -79,7 +77,6 @@ describe("DockerComposeService", () => {
composeOptions: [],
commandOptions: ["--volumes", "--remove-orphans"],
config: [],
log: true,
cwd: "/current/working/dir",
});
});
Expand All @@ -101,7 +98,6 @@ describe("DockerComposeService", () => {
expect(dockerCompose.logs).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
composeOptions: [],
config: ["docker-compose.yml"],
log: true,
cwd: "/current/working/dir",
follow: false,
});
Expand Down
1 change: 0 additions & 1 deletion src/services/docker-compose.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class DockerComposeService {
}: OptionsInputs): IDockerComposeOptions {
return {
config: composeFiles,
log: true,
composeOptions: composeFlags,
cwd: cwd,
};
Expand Down
5 changes: 5 additions & 0 deletions test/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
test-service-postgres:
image: postgres
environment:
POSTGRES_PASSWORD: example

0 comments on commit 52ccee8

Please sign in to comment.