Skip to content

Commit

Permalink
e2e test shards
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Wilcsinszky <[email protected]>
  • Loading branch information
pepov committed Jul 27, 2023
1 parent d3f36e3 commit ff756bb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
name: Go end2end tests
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
SHARD: [0, 1]
SHARDS: [2]

steps:
- name: Set up Docker Buildx
Expand Down Expand Up @@ -75,6 +80,9 @@ jobs:

- name: Run e2e tests
run: make test-e2e
env:
SHARD: ${{ matrix.SHARD }}
SHARDS: ${{ matrix.SHARDS }}

- name: Archive Test Results
if: always()
Expand All @@ -84,7 +92,7 @@ jobs:
path: build/_test
retention-days: 5

chart-minio:
chart:
name: Shell script tests with chart install
runs-on: ubuntu-latest
needs: build
Expand Down
17 changes: 17 additions & 0 deletions e2e/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,32 @@ package common

import (
"fmt"
"os"
"sync/atomic"
"testing"

"emperror.dev/errors"
"github.com/spf13/cast"
"github.com/stretchr/testify/assert"
)

var sequence uint32

func RequireNoError(t *testing.T, err error) {
if err != nil {
assert.Fail(t, fmt.Sprintf("Received unexpected error:\n%#v %+v", err, errors.GetDetails(err)))
t.FailNow()
}
}

func Initialize(t *testing.T) {
localSeq := atomic.AddUint32(&sequence, 1)
shards := cast.ToUint32(os.Getenv("SHARDS"))
shard := cast.ToUint32(os.Getenv("SHARD"))
if shards > 0 {
if localSeq%shards != shard {
t.Skipf("skipping %s as sequence %d not in shard %d", t.Name(), localSeq, shard)
}
}
t.Parallel()
}
2 changes: 1 addition & 1 deletion e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func init() {
}

func TestSyslogNGIsRunningAndForwardingLogs(t *testing.T) {
t.Parallel()
common.Initialize(t)
ns := "test"
releaseNameOverride := "e2e"
common.WithCluster("syslog-ng-1", t, func(t *testing.T, c common.Cluster) {
Expand Down
3 changes: 2 additions & 1 deletion e2e/volumedrain/volumedrain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {
}

func TestVolumeDrain_Downscale(t *testing.T) {
t.Parallel()
common.Initialize(t)
ns := "testing-1"
releaseNameOverride := "volumedrain"
testTag := "test.volumedrain"
Expand Down Expand Up @@ -262,6 +262,7 @@ func TestVolumeDrain_Downscale(t *testing.T) {
}

func TestVolumeDrain_Downscale_DeleteVolume(t *testing.T) {
common.Initialize(t)
t.Parallel()
ns := "testing-2"
releaseNameOverride := "volumedrain"
Expand Down

0 comments on commit ff756bb

Please sign in to comment.