mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-22 20:15:07 +00:00
try faster s3
This commit is contained in:
22
.github/workflows/e2e-tests.yml
vendored
22
.github/workflows/e2e-tests.yml
vendored
@@ -67,12 +67,12 @@ jobs:
|
|||||||
id: postgres-cache
|
id: postgres-cache
|
||||||
with:
|
with:
|
||||||
path: /tmp/postgres-image.tar
|
path: /tmp/postgres-image.tar
|
||||||
key: postgres-18-${{ runner.os }}
|
key: postgres-17-${{ runner.os }}
|
||||||
- name: Pull and save PostgreSQL image
|
- name: Pull and save PostgreSQL image
|
||||||
if: matrix.db == 'postgres' && steps.postgres-cache.outputs.cache-hit != 'true'
|
if: matrix.db == 'postgres' && steps.postgres-cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
docker pull postgres:18
|
docker pull postgres:17
|
||||||
docker save postgres:18 > /tmp/postgres-image.tar
|
docker save postgres:17 > /tmp/postgres-image.tar
|
||||||
- name: Load PostgreSQL image
|
- name: Load PostgreSQL image
|
||||||
if: matrix.db == 'postgres' && steps.postgres-cache.outputs.cache-hit == 'true'
|
if: matrix.db == 'postgres' && steps.postgres-cache.outputs.cache-hit == 'true'
|
||||||
run: docker load < /tmp/postgres-image.tar
|
run: docker load < /tmp/postgres-image.tar
|
||||||
@@ -108,22 +108,6 @@ jobs:
|
|||||||
if: matrix.storage == 's3' && steps.s3-cache.outputs.cache-hit == 'true'
|
if: matrix.storage == 's3' && steps.s3-cache.outputs.cache-hit == 'true'
|
||||||
run: docker load < /tmp/localstack-s3-image.tar
|
run: docker load < /tmp/localstack-s3-image.tar
|
||||||
|
|
||||||
- name: Cache AWS CLI Docker image
|
|
||||||
if: matrix.storage == 's3'
|
|
||||||
uses: actions/cache@v4
|
|
||||||
id: aws-cli-cache
|
|
||||||
with:
|
|
||||||
path: /tmp/aws-cli-image.tar
|
|
||||||
key: aws-cli-latest-${{ runner.os }}
|
|
||||||
- name: Pull and save AWS CLI image
|
|
||||||
if: matrix.storage == 's3' && steps.aws-cli-cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
docker pull amazon/aws-cli:latest
|
|
||||||
docker save amazon/aws-cli:latest > /tmp/aws-cli-image.tar
|
|
||||||
- name: Load AWS CLI image
|
|
||||||
if: matrix.storage == 's3' && steps.aws-cli-cache.outputs.cache-hit == 'true'
|
|
||||||
run: docker load < /tmp/aws-cli-image.tar
|
|
||||||
|
|
||||||
- name: Install test dependencies
|
- name: Install test dependencies
|
||||||
run: pnpm --filter pocket-id-tests install --frozen-lockfile
|
run: pnpm --filter pocket-id-tests install --frozen-lockfile
|
||||||
|
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ services:
|
|||||||
service: scim-test-server
|
service: scim-test-server
|
||||||
localstack-s3:
|
localstack-s3:
|
||||||
image: localstack/localstack:s3-latest
|
image: localstack/localstack:s3-latest
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localstack-s3:4566"]
|
|
||||||
interval: 1s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 10
|
|
||||||
create-bucket:
|
|
||||||
image: amazon/aws-cli:latest
|
|
||||||
environment:
|
environment:
|
||||||
AWS_ACCESS_KEY_ID: test
|
AWS_ACCESS_KEY_ID: test
|
||||||
AWS_SECRET_ACCESS_KEY: test
|
AWS_SECRET_ACCESS_KEY: test
|
||||||
AWS_DEFAULT_REGION: us-east-1
|
AWS_DEFAULT_REGION: us-east-1
|
||||||
depends_on:
|
volumes:
|
||||||
localstack-s3:
|
- ./localstack-init-s3.py:/etc/localstack/init/ready.d/10-init-s3.py
|
||||||
condition: service_healthy
|
healthcheck:
|
||||||
entrypoint: "aws --endpoint-url=http://localstack-s3:4566 s3 mb s3://pocket-id-test"
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
'curl -fs http://localstack-s3:4566/_localstack/init/ready | grep -q ''"completed": true''',
|
||||||
|
]
|
||||||
|
interval: 1s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 10
|
||||||
pocket-id:
|
pocket-id:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose.yml
|
file: docker-compose.yml
|
||||||
@@ -37,8 +37,8 @@ services:
|
|||||||
S3_SECRET_ACCESS_KEY: test
|
S3_SECRET_ACCESS_KEY: test
|
||||||
S3_FORCE_PATH_STYLE: true
|
S3_FORCE_PATH_STYLE: true
|
||||||
depends_on:
|
depends_on:
|
||||||
create-bucket:
|
localstack-s3:
|
||||||
condition: service_completed_successfully
|
condition: service_healthy
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pocket-id-test-data:
|
pocket-id-test-data:
|
||||||
|
|||||||
22
tests/setup/localstack-init-s3.py
Normal file
22
tests/setup/localstack-init-s3.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import boto3
|
||||||
|
from botocore.exceptions import ClientError
|
||||||
|
|
||||||
|
BUCKET_NAME = "pocket-id-test"
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
s3 = boto3.client(
|
||||||
|
"s3",
|
||||||
|
endpoint_url="http://localhost:4566",
|
||||||
|
aws_access_key_id="test",
|
||||||
|
aws_secret_access_key="test",
|
||||||
|
region_name="us-east-1",
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
s3.head_bucket(Bucket=BUCKET_NAME)
|
||||||
|
except ClientError:
|
||||||
|
s3.create_bucket(Bucket=BUCKET_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user