diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 4a9d751fc8..595219123b 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -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 @@ -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() @@ -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 diff --git a/e2e/common/helpers.go b/e2e/common/helpers.go index 8ff2d34774..f54cbb3c71 100644 --- a/e2e/common/helpers.go +++ b/e2e/common/helpers.go @@ -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() +} diff --git a/e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go b/e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go index 0654b15f8d..f5ed82c1c8 100644 --- a/e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go +++ b/e2e/syslog-ng-aggregator/syslog_ng_aggregator_test.go @@ -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) { diff --git a/e2e/volumedrain/volumedrain_test.go b/e2e/volumedrain/volumedrain_test.go index 27a554a1c8..7d45e6d5a5 100644 --- a/e2e/volumedrain/volumedrain_test.go +++ b/e2e/volumedrain/volumedrain_test.go @@ -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" @@ -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"