Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Add workflow dispatch for e2e tests
Browse files Browse the repository at this point in the history
Adds workflow dispatch for go-based e2e tests. Also moves
the e2e tests into a separate workflow since the "on"
clause is now different from other jobs.
  • Loading branch information
cevian committed Mar 25, 2022
1 parent 5c00671 commit bdcc960
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 130 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/go-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: End to End

defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}

on:
push:
branches: [master, main, force_test, release-*, staging, trying]
pull_request:
branches: ['**']
schedule:
- cron: "6 0 * * *"
workflow_dispatch:
inputs:
docker_image_prefix:
description: 'Docker image prefix'
required: true
default: 'ghcr.io/timescale/dev_promscale_extension:develop-ts2'

env:
golang-version: 1.18.0

jobs:
test-end-to-end:
name: e2e
runs-on: ubuntu-latest
strategy:
matrix:
test-setups:
- {name: "Singlenode (12)", shortname: "singlenode-12", tsdb: true, multi: false, pg: 12}
- {name: "Singlenode (13)", shortname: "singlenode-13", tsdb: true, multi: false, pg: 13}
- {name: "Singlenode", shortname: "singlenode-14", tsdb: true, multi: false, pg: 14}
- {name: "Without TimescaleDB", shortname: "no-timescaledb", tsdb: false, multi: false, pg: 14}
# TODO (james): Skipping multinode because tests are broken for now
# - {name: "Multinode", shortname: "multinode", tsdb: true, multi: true, pg: 14}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Checkout test data files
run: wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O pkg/tests/testdata/traces-dataset.sz

- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ env.golang-version }}
id: go

- name: Use Go module caching
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Figure out database container image from branch name
id: metadata
if: github.event_name != 'workflow_dispatch'
run: |
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#')
possible_branch_tag=$(echo ${branch_name}-ts2-pg${{matrix.test-setups.pg}})
develop_branch_tag=$(echo develop-ts2-pg${{matrix.test-setups.pg}})
image_base="ghcr.io/timescale/dev_promscale_extension"
docker_image=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag} ${image_base}:${develop_branch_tag})
echo "::set-output name=docker_image::${docker_image}"
- name: Figure out database container image via workflow input
id: metadata_wd
if: github.event_name == 'workflow_dispatch'
run: |
docker_image=$(echo ${{github.event.inputs.docker_image_prefix}}-pg${{matrix.test-setups.pg}})
echo "::set-output name=docker_image::${docker_image}"
- name: Test ${{ matrix.test-setups.name }}
env:
DOCKER_IMAGE: ${{ github.event_name == 'workflow_dispatch' && steps.metadata_wd.outputs.docker_image || steps.metadata.outputs.docker_image }}
TSDB: ${{ matrix.test-setups.tsdb }}
MULTI: ${{ matrix.test-setups.multi }}
SHORTNAME: ${{ matrix.test-setups.shortname }}
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-timescaledb=$TSDB -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE

# Added to summarize the matrix
tests-result:
name: e2e results
if: always()
needs:
- test-end-to-end
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
if: needs.test-end-to-end.result == 'success'
run: exit 0
- name: Mark the job as a failure
if: needs.test-end-to-end.result != 'success'
run: exit 1
46 changes: 1 addition & 45 deletions .github/workflows/go-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,51 +70,7 @@ jobs:

- name: Test extended dataset
run: go test -v -race -timeout=30m ./pkg/tests/end_to_end_tests/ -extended-test

test-end-to-end:
name: Test end-to-end extension combinations
runs-on: ubuntu-latest
strategy:
matrix:
test-setups:
- {name: "Singlenode (12)", tsdb: true, multi: false, pg: 12, nightly: false}
- {name: "Singlenode (14)", tsdb: true, multi: false, pg: 14, nightly: false}
- {name: "Without TimescaleDB", tsdb: false, multi: false, pg: 14, nightly: false}
- {name: "Multinode", tsdb: true, multi: true, pg: 14, nightly: false}
#- {name: "TimescaleDB Nightly (PG-13)", tsdb: true, multi: false, pg: 13, nightly: true}
#- {name: "TimescaleDB-Multinode Nightly (PG-13)", tsdb: true, multi: true, pg: 13, nightly: true}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
lfs: true

- name: Checkout LFS objects
run: git lfs checkout

- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ env.golang-version }}
id: go

- name: Use Go module caching
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test ${{ matrix.test-setups.name }}
env:
PG: ${{ matrix.test-setups.pg }}
TSDB: ${{ matrix.test-setups.tsdb }}
MULTI: ${{ matrix.test-setups.multi }}
NIGHTLY: ${{ matrix.test-setups.nightly }}
DOCKER_IMAGE: ghcr.io/timescale/dev_promscale_extension:develop-ts2-pg${{ matrix.test-setups.pg }}
run: go test ./pkg/tests/end_to_end_tests/ -use-timescaledb=$TSDB -use-multinode=$MULTI -use-timescaledb-nightly=$NIGHTLY -timescale-docker-image=$DOCKER_IMAGE


test-helm-chart:
name: Test helm-chart template generation
runs-on: ubuntu-latest
Expand Down
89 changes: 4 additions & 85 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,103 +66,22 @@ jobs:
${{ runner.os }}-go-
- name: Test
run: make unit > complete-test-run.log 2>&1
run: make unit > unit-run.log 2>&1

- name: 'Print failure logs'
if: ${{ failure() }}
run: grep "^[- F]" complete-test-run.log
run: cat unit-run.log

- name: 'Upload Log Artifact'
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: complete-test-run.log
path: complete-test-run.log
name: unit-run.log
path: unit-run.log
retention-days: 5

- name: Generated
run: |
go generate ./...
git diff --exit-code
test-end-to-end:
name: e2e
runs-on: ubuntu-latest
strategy:
matrix:
test-setups:
- {name: "Singlenode (12)", shortname: "singlenode-12", tsdb: true, multi: false, pg: 12}
- {name: "Singlenode (13)", shortname: "singlenode-13", tsdb: true, multi: false, pg: 13}
- {name: "Singlenode", shortname: "singlenode-14", tsdb: true, multi: false, pg: 14}
- {name: "Without TimescaleDB", shortname: "no-timescaledb", tsdb: false, multi: false, pg: 14}
# TODO (james): Skipping multinode because tests are broken for now
# - {name: "Multinode", shortname: "multinode", tsdb: true, multi: true, pg: 14}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Checkout test data files
run: wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O pkg/tests/testdata/traces-dataset.sz

- name: Set up Go ${{ env.golang-version }}
uses: actions/setup-go@v3.0.0
with:
go-version: ${{ env.golang-version }}
id: go

- name: Use Go module caching
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare metadata
id: metadata
run: |
branch_name=$(echo ${{github.head_ref || github.ref_name}} | sed 's#/#-#')
possible_branch_tag=$(echo ${branch_name}-ts2-pg${{matrix.test-setups.pg}})
develop_branch_tag=$(echo develop-ts2-pg${{matrix.test-setups.pg}})
image_base="ghcr.io/timescale/dev_promscale_extension"
docker_image=$(./scripts/fallback-docker.sh ${image_base}:${possible_branch_tag} ${image_base}:${develop_branch_tag})
echo "::set-output name=docker_image::${docker_image}"
- name: Test ${{ matrix.test-setups.name }}
env:
DOCKER_IMAGE: ${{steps.metadata.outputs.docker_image}}
TSDB: ${{ matrix.test-setups.tsdb }}
MULTI: ${{ matrix.test-setups.multi }}
SHORTNAME: ${{ matrix.test-setups.shortname }}
run: go test -race -timeout=30m ./pkg/tests/end_to_end_tests/ -use-timescaledb=$TSDB -use-multinode=$MULTI -timescale-docker-image=$DOCKER_IMAGE | tee $SHORTNAME-test-run.log 2>&1

- name: 'Upload Log Artifact'
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.test-setups.shortname }}-test-run.log
path: ${{ matrix.test-setups.shortname }}-test-run.log
retention-days: 5

# Added to summarize the matrix (otherwise we would need to list every single
# job in bors.toml)
tests-result:
name: e2e results
if: always()
needs:
- test-end-to-end
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
if: needs.test-end-to-end.result == 'success'
run: exit 0
- name: Mark the job as a failure
if: needs.test-end-to-end.result != 'success'
run: exit 1

0 comments on commit bdcc960

Please sign in to comment.