Skip to content

Commit

Permalink
ci: Add more e2e tests (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Mar 24, 2022
1 parent a5c3f0f commit b4aa865
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 13 deletions.
13 changes: 7 additions & 6 deletions .github/e2e/assert-n2n-mainnet-origin-blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: assert-n2n-mainnet-origin-blocks
name: ${TEST_NAME}
data:
daemon.toml: |-
[source]
Expand All @@ -11,7 +11,7 @@ data:
magic = "mainnet"
[source.finalize]
max_block_quantity: 5000
max_block_quantity = 2000
[source.intersect]
type = "Origin"
Expand All @@ -23,14 +23,15 @@ data:
apiVersion: batch/v1
kind: Job
metadata:
name: assert-n2n-mainnet-origin-blocks
name: ${TEST_NAME}
labels:
app: assert-n2n-mainnet-origin-blocks
app: ${TEST_NAME}
spec:
backoffLimit: 1
template:
metadata:
labels:
app: assert-n2n-mainnet-origin-blocks
app: ${TEST_NAME}
spec:
restartPolicy: "Never"
containers:
Expand All @@ -54,4 +55,4 @@ spec:
volumes:
- name: oura-config
configMap:
name: oura
name: ${TEST_NAME}
58 changes: 58 additions & 0 deletions .github/e2e/assert-n2n-mainnet-tip-blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ${TEST_NAME}
data:
daemon.toml: |-
[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
magic = "mainnet"
[source.finalize]
max_block_quantity = 50
[source.intersect]
type = "Tip"
[sink]
type = "Assert"
break_on_failure = true
---
apiVersion: batch/v1
kind: Job
metadata:
name: ${TEST_NAME}
labels:
app: ${TEST_NAME}
spec:
backoffLimit: 1
template:
metadata:
labels:
app: ${TEST_NAME}
spec:
restartPolicy: "Never"
containers:
- name: main
image: ${TARGET_IMAGE}
env:
- name: "RUST_LOG"
value: "warn"
resources:
requests:
memory: 100Mi
cpu: 50m
limits:
memory: 500Mi
cpu: 200m
args:
- "daemon"
volumeMounts:
- mountPath: /etc/oura
name: oura-config
volumes:
- name: oura-config
configMap:
name: ${TEST_NAME}
58 changes: 58 additions & 0 deletions .github/e2e/assert-n2n-testnet-origin-blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ${TEST_NAME}
data:
daemon.toml: |-
[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-testnet.iohkdev.io:3001"]
magic = "testnet"
[source.finalize]
max_block_quantity = 2000
[source.intersect]
type = "Origin"
[sink]
type = "Assert"
break_on_failure = true
---
apiVersion: batch/v1
kind: Job
metadata:
name: ${TEST_NAME}
labels:
app: ${TEST_NAME}
spec:
backoffLimit: 1
template:
metadata:
labels:
app: ${TEST_NAME}
spec:
restartPolicy: "Never"
containers:
- name: main
image: ${TARGET_IMAGE}
env:
- name: "RUST_LOG"
value: "warn"
resources:
requests:
memory: 100Mi
cpu: 50m
limits:
memory: 500Mi
cpu: 200m
args:
- "daemon"
volumeMounts:
- mountPath: /etc/oura
name: oura-config
volumes:
- name: oura-config
configMap:
name: ${TEST_NAME}
58 changes: 58 additions & 0 deletions .github/e2e/assert-n2n-testnet-tip-blocks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ${TEST_NAME}
data:
daemon.toml: |-
[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-testnet.iohkdev.io:3001"]
magic = "testnet"
[source.finalize]
max_block_quantity = 20
[source.intersect]
type = "Tip"
[sink]
type = "Assert"
break_on_failure = true
---
apiVersion: batch/v1
kind: Job
metadata:
name: ${TEST_NAME}
labels:
app: ${TEST_NAME}
spec:
backoffLimit: 1
template:
metadata:
labels:
app: ${TEST_NAME}
spec:
restartPolicy: "Never"
containers:
- name: main
image: ${TARGET_IMAGE}
env:
- name: "RUST_LOG"
value: "warn"
resources:
requests:
memory: 100Mi
cpu: 50m
limits:
memory: 500Mi
cpu: 200m
args:
- "daemon"
volumeMounts:
- mountPath: /etc/oura
name: oura-config
volumes:
- name: oura-config
configMap:
name: ${TEST_NAME}
52 changes: 45 additions & 7 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ env:
CLUSTER: m1-prod-6x3kk4

jobs:
test:
name: End to End tests
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -33,24 +32,63 @@ jobs:
push: true
tags: ${{ env.TARGET_IMAGE }}

prepare:
needs: ["build"]
runs-on: ubuntu-latest

steps:
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ClusterAdmin
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ClusterAdminRole
role-session-name: Github-e2e-Rollout
role-duration-seconds: 1200

- name: Login to EKS
run: aws eks update-kubeconfig --name ${CLUSTER}

- name: Create Namespace
run: kubectl create namespace e2e-${GITHUB_RUN_NUMBER}

test:
needs: ["prepare"]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: assert-n2n-mainnet-origin-blocks
- name: assert-n2n-mainnet-tip-blocks
- name: assert-n2n-testnet-origin-blocks
- name: assert-n2n-testnet-tip-blocks

steps:
- uses: actions/checkout@v2

- uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ClusterAdminRole
role-session-name: Github-e2e-Rollout
role-duration-seconds: 3600

- name: Login to EKS
run: aws eks update-kubeconfig --name ${CLUSTER}

- name: Rollout Job
working-directory: .github/e2e
env:
TEST_NAME: ${{ matrix.name }}
run: |+
kubectl create namespace e2e-${{ env.GITHUB_RUN_NUMBER }}
envsubst < ${TEST_NAME}.yaml | kubectl apply -n e2e-${GITHUB_RUN_NUMBER} -f -
- name: Rollout Jobs
working-directory: .github/e2e
- name: Wait for Completion
env:
TEST_NAME: ${{ matrix.name }}
run: |+
envsubst < assert-n2n-mainnet-origin-blocks.yaml | kubectl apply -n e2e-${{ env.GITHUB_RUN_NUMBER }} -f -
kubectl wait --for=condition=complete --timeout=1800s job ${TEST_NAME} -n e2e-${GITHUB_RUN_NUMBER}
kubectl get job ${TEST_NAME} -o jsonpath={.status.succeeded} -n e2e-${GITHUB_RUN_NUMBER}

0 comments on commit b4aa865

Please sign in to comment.