Skip to content

Commit aa54d51

Browse files
authored
refactor(e2e): drop the dead test sharding from Initialize
Review feedback on kube-logging#2301. The sharding wrapped around t.Parallel was dead and inverted. sequence is a per-binary counter and ten of the thirteen suites hold exactly one test, so localSeq is always 1 in those binaries. With SHARDS=2 that gives 1 % 2 != 0 for shard 0, which skips, against 1 % 2 == 1 for shard 1, which runs: shard 0 would run nothing and shard 1 everything. Nothing exercised it either way, because the matrix that would set SHARD and SHARDS is commented out in e2e.yaml. E2E_CLUSTERS bounds the concurrency the sharding was reaching for, so this drops it rather than reworking it to shard on t.Name(), and leaves Initialize as the bare t.Parallel the suites already expect. Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
1 parent 8e5a84f commit aa54d51

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

e2e/common/helpers.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ package common
1717
import (
1818
"context"
1919
"fmt"
20-
"os"
21-
"sync/atomic"
2220
"testing"
2321
"time"
2422

2523
"emperror.dev/errors"
26-
"github.com/spf13/cast"
2724
"github.com/stretchr/testify/assert"
2825
corev1 "k8s.io/api/core/v1"
2926
"k8s.io/apimachinery/pkg/api/resource"
@@ -48,8 +45,6 @@ const (
4845
NodeExporterTag = "local"
4946
)
5047

51-
var sequence uint32
52-
5348
func RequireNoError(t *testing.T, err error) {
5449
if err != nil {
5550
assert.Fail(t, fmt.Sprintf("Received unexpected error:\n%#v %+v", err, errors.GetDetails(err)))
@@ -58,14 +53,6 @@ func RequireNoError(t *testing.T, err error) {
5853
}
5954

6055
func Initialize(t *testing.T) {
61-
localSeq := atomic.AddUint32(&sequence, 1)
62-
shards := cast.ToUint32(os.Getenv("SHARDS"))
63-
shard := cast.ToUint32(os.Getenv("SHARD"))
64-
if shards > 0 {
65-
if localSeq%shards != shard {
66-
t.Skipf("skipping %s as sequence %d not in shard %d", t.Name(), localSeq, shard)
67-
}
68-
}
6956
t.Parallel()
7057
}
7158

0 commit comments

Comments
 (0)