feat(lambda): give function containers the AWS environment #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: K8s Backends | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'crates/fakecloud-lambda/**' | |
| - 'crates/fakecloud-elasticache/**' | |
| - 'crates/fakecloud-rds/**' | |
| - 'crates/fakecloud-ecs/**' | |
| - 'crates/fakecloud-ec2/**' | |
| - 'crates/fakecloud-k8s/**' | |
| - '.github/workflows/lambda-k8s.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'crates/fakecloud-lambda/**' | |
| - 'crates/fakecloud-elasticache/**' | |
| - 'crates/fakecloud-rds/**' | |
| - 'crates/fakecloud-ecs/**' | |
| - 'crates/fakecloud-ec2/**' | |
| - 'crates/fakecloud-k8s/**' | |
| - '.github/workflows/lambda-k8s.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| k8s-integration: | |
| name: K8s backend (kind) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | |
| - name: Create kind cluster | |
| uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0 | |
| with: | |
| cluster_name: fakecloud-k8s-test | |
| # Single node is enough — these tests exercise control-plane | |
| # interactions (create/list/delete pods, reap orphans by label) | |
| # plus exec into a real redis pod. Multi-node would just slow boot. | |
| wait: 120s | |
| - name: Pre-pull images into the cluster | |
| run: | | |
| pull() { | |
| for i in 1 2 3; do | |
| docker pull "$1" && return 0 | |
| echo "docker pull $1 attempt $i failed; retrying"; sleep $((i * 5)) | |
| done | |
| echo "docker pull $1 failed after 3 attempts"; return 1 | |
| } | |
| for img in registry.k8s.io/pause:3.10 redis:7-alpine postgres:16-alpine busybox:1.36; do | |
| pull "$img" | |
| kind load docker-image "$img" --name fakecloud-k8s-test | |
| done | |
| - name: Lambda K8s integration tests | |
| env: | |
| FAKECLOUD_K8S_TEST: '1' | |
| run: | | |
| cargo test -p fakecloud-lambda \ | |
| --features k8s-integration \ | |
| --test k8s_integration \ | |
| -- --test-threads=1 | |
| - name: ElastiCache K8s integration tests | |
| env: | |
| FAKECLOUD_K8S_TEST: '1' | |
| run: | | |
| cargo test -p fakecloud-elasticache \ | |
| --features k8s-integration \ | |
| --test k8s_integration \ | |
| -- --test-threads=1 | |
| - name: RDS K8s integration tests | |
| env: | |
| FAKECLOUD_K8S_TEST: '1' | |
| run: | | |
| cargo test -p fakecloud-rds \ | |
| --features k8s-integration \ | |
| --test k8s_integration \ | |
| -- --test-threads=1 | |
| - name: ECS K8s integration tests | |
| env: | |
| FAKECLOUD_K8S_TEST: '1' | |
| run: | | |
| cargo test -p fakecloud-ecs \ | |
| --features k8s-integration \ | |
| --test k8s_integration \ | |
| -- --test-threads=1 | |
| - name: EC2 K8s integration tests | |
| env: | |
| FAKECLOUD_K8S_TEST: '1' | |
| run: | | |
| cargo test -p fakecloud-ec2 \ | |
| --features k8s-integration \ | |
| --test k8s_integration \ | |
| -- --test-threads=1 |