Skip to content

Commit

Permalink
feat: add storage leak test (#222)
Browse files Browse the repository at this point in the history
* feat: add storage leak test

* cleanup test

* add e2e to workflow

(cherry picked from commit 64c5cd5)

# Conflicts:
#	.github/workflows/packet-forward-middleware.yml
#	middleware/packet-forward-middleware/Makefile
  • Loading branch information
joelsmith-2019 authored and mergify[bot] committed Nov 22, 2024
1 parent b06a093 commit b961f81
Show file tree
Hide file tree
Showing 4 changed files with 395 additions and 1 deletion.
109 changes: 109 additions & 0 deletions .github/workflows/packet-forward-middleware.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: packet-forward-middleware
on:
pull_request:
paths:
- "middleware/packet-forward-middleware/**"
- ".github/workflows/packet-forward-middleware.yml"

env:
LINT_VERSION: v1.57.1
GO_VERSION: 1.22.1
WORKING_DIRECTORY: middleware/packet-forward-middleware

DOCKER_TAG: pfm:local
TAR_PATH: /tmp/pfm-docker-image.tar
IMAGE_NAME: pfm-docker-image

jobs:
golangci:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: ${{ env.LINT_VERSION }}
working-directory: ${{ env.WORKING_DIRECTORY }}
args: --timeout=5m

test:
runs-on: ubuntu-latest
name: test
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4

- name: Test
run: go test ./...
working-directory: ${{ env.WORKING_DIRECTORY }}

build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export
uses: docker/build-push-action@v5
with:
context: ${{ env.WORKING_DIRECTORY }}
tags: ${{ env.DOCKER_TAG }}
outputs: type=docker,dest=${{ env.TAR_PATH }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.TAR_PATH }}

e2e-tests:
needs: build-docker
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
strategy:
matrix:
test:
- "ictest-forward"
- "ictest-timeout"
- "ictest-storage-leak"
- "ictest-upgrade"
- "ictest-nonrefundable"
fail-fast: false

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/checkout@v4

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: /tmp

- name: Load Docker Image
run: |
docker image load -i ${{ env.TAR_PATH }}
docker image load -i testing/previous_images/pfm_7_0_1.tar
docker image ls -a
- name: Run Test
run: make ${{ matrix.test }}
25 changes: 25 additions & 0 deletions middleware/packet-forward-middleware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,31 @@ endif
.PHONY: run-tests test test-all $(TEST_TARGETS)

###############################################################################
<<<<<<< HEAD
=======
### e2e interchain test ###
###############################################################################

local-image:
docker build . -t pfm:local

ictest-forward:
cd e2e && go test -race -v -timeout 15m -run TestPacketForwardMiddleware .

ictest-timeout:
cd e2e && go test -race -v -timeout 15m -run TestTimeoutOnForward .

ictest-storage-leak:
cd e2e && go test -race -v -timeout 15m -run TestStorageLeak .

ictest-upgrade:
cd e2e && go test -race -v -timeout 15m -run TestPFMUpgrade .

ictest-nonrefundable:
cd e2e && go test -race -v -timeout 15m -run TestNonRefundable .

###############################################################################
>>>>>>> 64c5cd5 (feat: add storage leak test (#222))
### Linting ###
###############################################################################

Expand Down
Loading

0 comments on commit b961f81

Please sign in to comment.