Skip to content

Commit fd35791

Browse files
committed
Setup docker container for testing
1 parent 0dc5f7a commit fd35791

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

.github/workflows/testsuite.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
path: metacpan-cpan-extracted-lite
2525
token: ${{ secrets.GITHUB_TOKEN }}
2626

27+
- name: Setup container
28+
run: |
29+
cd main-repo
30+
make test-setup
31+
2732
# Set up Docker Compose
2833
- name: Run tests
2934
run: |

Makefile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11

2-
.PHONY: all up-dev up-prod up test t
2+
.PHONY: all up-dev up-prod up test test-setup t
33

44
APP_ENV ?= development
5+
DOCKER_ENV := $(if $(filter $(APP_ENV),test-setup),test,$(APP_ENV))
56

67
# Add overload config for docker-compose
78
ifeq ($(APP_ENV),development)
89
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
10+
else ifeq ($(APP_ENV),test-setup)
11+
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml:docker-compose.test-setup.yml
912
else ifeq ($(APP_ENV),test)
1013
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml:docker-compose.test.yml
1114
else
@@ -16,8 +19,8 @@ all:
1619
$(MAKE) up
1720

1821
up:
19-
ln -sf config/docker-compose.$(APP_ENV).env .env
20-
APP_ENV=$(APP_ENV) docker compose -f $(subst :, -f ,$(COMPOSE_FILE)) up --build --exit-code-from grep
22+
ln -sf config/docker-compose.$(DOCKER_ENV).env .env
23+
APP_ENV=$(DOCKER_ENV) docker compose -f $(subst :, -f ,$(COMPOSE_FILE)) up --build --exit-code-from grep
2124

2225
up-dev:
2326
$(MAKE) up APP_ENV=development
@@ -27,5 +30,11 @@ up-prod:
2730

2831
t: test
2932

33+
test-setup:
34+
$(MAKE) up APP_ENV=test-setup
35+
3036
test:
31-
$(MAKE) up APP_ENV=test
37+
$(MAKE) up APP_ENV=test
38+
39+
bash:
40+
docker exec -it grep-container /bin/bash

docker-compose.test-setup.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
grep:
3+
command: ["/usr/bin/true"]
4+
environment:
5+
- APP_ENV=test

src/environments/production-docker.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@ grepcpan:
2020
maxworkers: 256
2121
root_dir: '/metacpan-grep-front-end'
2222
gitrepo: '/shared/metacpan_git'
23-
# binaries:
24-
# git: '/usr/bin/git'
2523
cache:
2624
directory: '/var/tmp'

src/environments/production.yml.original

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/t/GrepCpan-Grep-dosearch.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ my $query_looks_sane = validator(
104104
field distro => D();
105105
field files => array {
106106
all_items sub {
107-
like $_ => qr{^[/\w\-_\.]+$},
107+
like $_ => qr{^[/\w\-_\.\+]+$},
108108
'results/file: valid path file';
109109
};
110110
};

0 commit comments

Comments
 (0)