Skip to content

Commit

Permalink
Regression: Drop flaky test (#371)
Browse files Browse the repository at this point in the history
### Description
What does this change do and why?
- Drop test that causes a race condition failure by go

Thank you!

Signed-off-by: Adil Fulara <[email protected]>
Co-authored-by: Adil Fulara <[email protected]>
  • Loading branch information
adilfulara and Adil Fulara authored Jan 3, 2025
1 parent b285613 commit 2ed99fb
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions admiral/pkg/controller/admiral/shard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import (
"errors"
"fmt"
admiralapiv1 "github.com/istio-ecosystem/admiral-api/pkg/apis/admiral/v1"
fake2 "github.com/istio-ecosystem/admiral-api/pkg/client/clientset/versioned/typed/admiral/v1/fake"
"github.com/istio-ecosystem/admiral/admiral/pkg/client/loader"
"github.com/istio-ecosystem/admiral/admiral/pkg/controller/common"
"github.com/istio-ecosystem/admiral/admiral/pkg/test"
"github.com/stretchr/testify/assert"
coreV1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"
k8stesting "k8s.io/client-go/testing"
"testing"
)

Expand Down Expand Up @@ -109,10 +106,9 @@ func TestShardController_Deleted(t *testing.T) {
func TestShardController_Get(t *testing.T) {

type args struct {
obj interface{}
retry bool
cacheItems map[string]*admiralapiv1.Shard
fakeClientResponse *admiralapiv1.Shard
obj interface{}
retry bool
cacheItems map[string]*admiralapiv1.Shard
}

type want struct {
Expand Down Expand Up @@ -146,28 +142,10 @@ func TestShardController_Get(t *testing.T) {
obj: &admiralapiv1.Shard{ObjectMeta: v1.ObjectMeta{Name: "test"}},
},
},
{
name: "lookup without retry",
args: args{
obj: &admiralapiv1.Shard{ObjectMeta: v1.ObjectMeta{Name: "test"}},
cacheItems: map[string]*admiralapiv1.Shard{
"test": {ObjectMeta: v1.ObjectMeta{Name: "test"}},
},
fakeClientResponse: &admiralapiv1.Shard{ObjectMeta: v1.ObjectMeta{Name: "test"}},
},
want: want{
obj: &admiralapiv1.Shard{ObjectMeta: v1.ObjectMeta{Name: "test"}},
},
},
}
for _, c := range testCases {
t.Run(c.name, func(t *testing.T) {
sCtrl, _ := getNewMockShardController()
if c.args.fakeClientResponse != nil {
sCtrl.CrdClient.AdmiralV1().(*fake2.FakeAdmiralV1).PrependReactor("get", "*", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
return true, c.args.fakeClientResponse, nil
})
}
for _, shard := range c.args.cacheItems {
sCtrl.Cache.UpdateShardToClusterCache("test", shard)
}
Expand Down

0 comments on commit 2ed99fb

Please sign in to comment.