mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
cleanup: resolve parallel test issue
This commit resolves parallel test issues and also excludes internal/util/conn_pool_test.go as those test can't run in parallel. Updates: #1586 Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
parent
8b3136e696
commit
69c9e5ffb1
@ -23,6 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestIsThickProvisionRequest(t *testing.T) {
|
func TestIsThickProvisionRequest(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
req := &csi.CreateVolumeRequest{
|
req := &csi.CreateVolumeRequest{
|
||||||
Name: "fake",
|
Name: "fake",
|
||||||
Parameters: map[string]string{
|
Parameters: map[string]string{
|
||||||
|
@ -63,21 +63,23 @@ func TestValidateSchedulingInterval(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
st := tt
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
got, err := validateSchedulingInterval(st.interval)
|
t.Parallel()
|
||||||
if (err != nil) != st.wantErr {
|
got, err := validateSchedulingInterval(tt.interval)
|
||||||
t.Errorf("validateSchedulingInterval() error = %v, wantErr %v", err, st.wantErr)
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("validateSchedulingInterval() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got, st.want) {
|
if !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("validateSchedulingInterval() = %v, want %v", got, st.want)
|
t.Errorf("validateSchedulingInterval() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetSchedulingDetails(t *testing.T) {
|
func TestGetSchedulingDetails(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
parameters map[string]string
|
parameters map[string]string
|
||||||
@ -137,18 +139,19 @@ func TestGetSchedulingDetails(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
st := tt
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
interval, startTime, err := getSchedulingDetails(st.parameters)
|
t.Parallel()
|
||||||
if (err != nil) != st.wantErr {
|
interval, startTime, err := getSchedulingDetails(tt.parameters)
|
||||||
t.Errorf("getSchedulingDetails() error = %v, wantErr %v", err, st.wantErr)
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("getSchedulingDetails() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(interval, st.wantInterval) {
|
if !reflect.DeepEqual(interval, tt.wantInterval) {
|
||||||
t.Errorf("getSchedulingDetails() interval = %v, want %v", interval, st.wantInterval)
|
t.Errorf("getSchedulingDetails() interval = %v, want %v", interval, tt.wantInterval)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(startTime, st.wantStartTime) {
|
if !reflect.DeepEqual(startTime, tt.wantStartTime) {
|
||||||
t.Errorf("getSchedulingDetails() startTime = %v, want %v", startTime, st.wantStartTime)
|
t.Errorf("getSchedulingDetails() startTime = %v, want %v", startTime, tt.wantStartTime)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ func (cp *ConnPool) fakeGet(monitors, user, keyfile string) (*rados.Conn, string
|
|||||||
return conn, unique, nil
|
return conn, unique, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:paralleltest,tparallel
|
||||||
func TestConnPool(t *testing.T) {
|
func TestConnPool(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
cp := NewConnPool(interval, expiry)
|
cp := NewConnPool(interval, expiry)
|
||||||
defer cp.Destroy()
|
defer cp.Destroy()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user